From c54744ce4d6cdfc740a240d2a94ef6835bd436c7 Mon Sep 17 00:00:00 2001 From: Ovnuniarchos Date: Sun, 12 Jun 2016 20:03:24 +0200 Subject: [PATCH] Documented many Physics2D* classes (cherry picked from commit 471ab4e6ff1b94e09835b7e3a2a82ea9e65f9214) --- doc/base/classes.xml | 295 ++++++++++++++++++++++++++++++---- servers/physics_2d_server.cpp | 8 + 2 files changed, 275 insertions(+), 28 deletions(-) diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 2bd4dc2d6ec..2ab63d86bf7 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -8401,7 +8401,7 @@ Concave polygon 2D shape resource for physics. - Concave polygon 2D shape resource for physics. It is made out of segments and is very optimal for complex polygonal concave collisions. It is really not advised to use for RigidBody nodes. A CollisionPolygon2D in convex decomposition mode (solids) or several convex objects are advised for that instead. Otherwise, a concave polygon 2D shape is better for static collisions. + Concave polygon 2D shape resource for physics. It is made out of segments and is very optimal for complex polygonal concave collisions. It is really not advised to use for [RigidBody2D] nodes. A CollisionPolygon2D in convex decomposition mode (solids) or several convex objects are advised for that instead. Otherwise, a concave polygon 2D shape is better for static collisions. The main difference between a [ConvexPolygonShape2D] and a [ConcavePolygonShape2D] is that a concave polygon assumes it is concave and uses a more complex method of collision detection, and a convex one forces itself to be convex in order to speed up collision detection. @@ -23253,12 +23253,14 @@ This method controls whether the position between two cached points is interpola + Return the rate at which the body stops moving, if there are not any other forces moving it. + Return the rate at which the body stops rotating, if there are not any other forces moving it. @@ -23353,6 +23355,7 @@ This method controls whether the position between two cached points is interpola + Return the local normal (of this body) of the contact point. @@ -23370,7 +23373,7 @@ This method controls whether the position between two cached points is interpola - Return the RID of the collider. + Return the [RID] of the collider. @@ -23415,6 +23418,7 @@ This method controls whether the position between two cached points is interpola + Return the metadata of the collided shape. This metadata is different from [method Object.get_meta], and is set with [method Physics2DServer.shape_set_data]. @@ -23451,8 +23455,10 @@ This method controls whether the position between two cached points is interpola + Software implementation of [Physics2DDirectBodyState]. + Software implementation of [Physics2DDirectBodyState]. This object exposes no new methods or properties and should not be used, as [Physics2DDirectBodyState] selects the best implementation available. @@ -23481,6 +23487,13 @@ This method controls whether the position between two cached points is interpola + Check whether a point is inside any shape. The shapes the point is inside of are returned in an array containing dictionaries with the following fields: + shape: Shape index within the object the point is in. + metadata: Metadata of the shape the point is in. This metadata is different from [method Object.get_meta], and is set with [method Physics2DServer.shape_set_data]. + collider_id: Id of the object the point is in. + collider: Object the point is inside of. + rid: [RID] of the object the point is in. + Additionally, the method can take an array of objects or [RID]s that are to be excluded from collisions, a bitmask representing the physics layers to check in, and another bitmask for the types of objects to check (see TYPE_MASK_* constants). @@ -23497,15 +23510,16 @@ This method controls whether the position between two cached points is interpola - Intersect a ray in a given space, the returned object is a dictionary with the following fields: - position: place where ray is stopped. - normal: normal of the object at the point where the ray was stopped. - shape: shape index of the object against which the ray was stopped. - collider_: collider against which the ray was stopped. - collider_id: collider id of the object against which the ray was stopped. - collider: collider object against which the ray was stopped. + Intersect a ray in a given space. The returned object is a dictionary with the following fields: + position: Place where ray is stopped. + normal: Normal of the object at the point where the ray was stopped. + shape: Shape index within the object against which the ray was stopped. + metadata: Metadata of the shape against which the ray was stopped. This metadata is different from [method Object.get_meta], and is set with [method Physics2DServer.shape_set_data]. + collider_id: Id of the object against which the ray was stopped. + collider: Object against which the ray was stopped. rid: [RID] of the object against which the ray was stopped. If the ray did not intersect anything, then an empty dictionary (dir.empty()==true) is returned instead. + Additionally, the method can take an array of objects or [RID]s that are to be excluded from collisions, a bitmask representing the physics layers to check in, and another bitmask for the types of objects to check (see TYPE_MASK_* constants). @@ -23516,7 +23530,13 @@ This method controls whether the position between two cached points is interpola - Intersect a given shape (RID or [Shape2D]) against the space, the intersected shapes are returned in a special result object. + Check the intersections of a shape, given through a [Physics2DShapeQueryParameters] object, against the space. The intersected shapes are returned in an array containing dictionaries with the following fields: + shape: Shape index within the object the shape intersected. + metadata: Metadata of the shape intersected by the shape given through the [Physics2DShapeQueryParameters]. This metadata is different from [method Object.get_meta], and is set with [method Physics2DServer.shape_set_data]. + collider_id: Id of the object the shape intersected. + collider: Object the shape intersected. + rid: [RID] of the object the shape intersected. + The number of intersections can be limited with the second paramater, to reduce the processing time. @@ -23525,6 +23545,8 @@ This method controls whether the position between two cached points is interpola + Check whether the shape can travel to a point. If it can, the method will return an array with two floats: The first is the distance the shape can move in that direction without colliding, and the second is the distance at which it will collide. + If the shape can not move, the array will be empty. @@ -23535,6 +23557,7 @@ This method controls whether the position between two cached points is interpola + Check the intersections of a shape, given through a [Physics2DShapeQueryParameters] object, against the space. The resulting array contains a list of points where the shape intersects another. Like with [method intersect_shape], the number of returned results can be limited to save processing time. @@ -23543,21 +23566,37 @@ This method controls whether the position between two cached points is interpola + Check the intersections of a shape, given through a [Physics2DShapeQueryParameters] object, against the space. If it collides with more than a shape, the nearest one is selected. The returned object is a dictionary containing the following fields: + pointo: Place where the shapes intersect. + normal: Normal of the object at the point where the shapes intersect. + shape: Shape index within the object against which the shape intersected. + metadata: Metadata of the shape against which the shape intersected. This metadata is different from [method Object.get_meta], and is set with [method Physics2DServer.shape_set_data]. + collider_id: Id of the object against which the shape intersected. + collider: Object against which the shape intersected. + rid: [RID] of the object against which the shape intersected. + linear_velocity: The movement vector of the object the shape intersected, if it was a body. If it was an area, it is (0,0). + If the shape did not intersect anything, then an empty dictionary (dir.empty()==true) is returned instead. + Check for collisions with static bodies. + Check for collisions with kinematic bodies. + Check for collisions with rigid bodies. + Check for collisions with rigid bodies in character mode. + Check for collisions with areas. + Check for collisions with any kind of bodies (but not areas). @@ -23566,7 +23605,7 @@ This method controls whether the position between two cached points is interpola Physics 2D Server. - Physics 2D Server is the server responsible for all 2D physics. + Physics 2D Server is the server responsible for all 2D physics. It can create many kinds of physics objects, but does not insert them on the node tree. @@ -23575,6 +23614,7 @@ This method controls whether the position between two cached points is interpola + Create a shape of type SHAPE_*. Does not assign it to a body or an area. To do so, you must use [method area_set_shape] or [method body_set_shape]. @@ -23583,6 +23623,7 @@ This method controls whether the position between two cached points is interpola + Set the shape data that defines its shape and size. The data to be passed depends on the kind of shape created [method shape_get_type]. @@ -23591,18 +23632,23 @@ This method controls whether the position between two cached points is interpola + Return the type of shape (see SHAPE_* constants). + + + Return the shape data. + Create a space. A space is a collection of parameters for the physics engine that can be assigned to an area or a body. It can be assigned to an area with [method area_set_space], or to a body with [method body_set_space]. @@ -23611,6 +23657,7 @@ This method controls whether the position between two cached points is interpola + Mark a space as active. It will not have an effect, unless it is assigned to an area or body. @@ -23619,6 +23666,7 @@ This method controls whether the position between two cached points is interpola + Return whether the space is active. @@ -23629,6 +23677,7 @@ This method controls whether the position between two cached points is interpola + Set the value for a space parameter. A list of available parameters is on the SPACE_PARAM_* constants. @@ -23639,6 +23688,7 @@ This method controls whether the position between two cached points is interpola + Return the value of a space parameter. @@ -23647,12 +23697,14 @@ This method controls whether the position between two cached points is interpola + Return the state of a space, a [Physics2DDirectSpaceState]. This object can be used to make collision/intersection queries. + Create an [Area2D]. @@ -23661,6 +23713,7 @@ This method controls whether the position between two cached points is interpola + Assign a space to the area. @@ -23669,6 +23722,7 @@ This method controls whether the position between two cached points is interpola + Return the space assigned to the area. @@ -23677,6 +23731,7 @@ This method controls whether the position between two cached points is interpola + Set the space override mode for the area. The modes are described in the constants AREA_SPACE_OVERRIDE_*. @@ -23685,6 +23740,7 @@ This method controls whether the position between two cached points is interpola + Return the space override mode for the area. @@ -23695,6 +23751,7 @@ This method controls whether the position between two cached points is interpola + Add a shape to the area, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index. @@ -23705,6 +23762,7 @@ This method controls whether the position between two cached points is interpola + Substitute a given area shape by another. The old shape is selected by its index, the new one by its [RID]. @@ -23715,6 +23773,7 @@ This method controls whether the position between two cached points is interpola + Set the transform matrix for an area shape. @@ -23723,6 +23782,7 @@ This method controls whether the position between two cached points is interpola + Return the number of shapes assigned to an area. @@ -23733,6 +23793,7 @@ This method controls whether the position between two cached points is interpola + Return the [RID] of the nth shape of an area. @@ -23743,6 +23804,7 @@ This method controls whether the position between two cached points is interpola + Return the transform matrix of a shape within an area. @@ -23751,12 +23813,14 @@ This method controls whether the position between two cached points is interpola + Remove a shape from an area. It does not delete the shape, so it can be reassigned later. + Remove all shapes from an area. It does not delete the shapes, so they can be reassigned later. @@ -23765,6 +23829,7 @@ This method controls whether the position between two cached points is interpola + Assign the area to one or many physics layers. @@ -23773,6 +23838,7 @@ This method controls whether the position between two cached points is interpola + Set which physics layers the area will monitor. @@ -23783,6 +23849,7 @@ This method controls whether the position between two cached points is interpola + Set the value for an area parameter. A list of available parameters is on the AREA_PARAM_* constants. @@ -23791,14 +23858,18 @@ This method controls whether the position between two cached points is interpola + Set the transform matrix for an area. + + + Return an area parameter value. @@ -23807,6 +23878,7 @@ This method controls whether the position between two cached points is interpola + Return the transform matrix for an area. @@ -23815,6 +23887,7 @@ This method controls whether the position between two cached points is interpola + Assign the area to a descendant of [Object], so it can exist in the node tree. @@ -23823,6 +23896,7 @@ This method controls whether the position between two cached points is interpola + Get the instance ID of the object the area is assigned to. @@ -23833,6 +23907,12 @@ This method controls whether the position between two cached points is interpola + Set the function to call when any body/area enters or exits the area. This callback will be called for any object interacting with the area, and takes five parameters: + 1: AREA_BODY_ADDED or AREA_BODY_REMOVED, depending on whether the object entered or exited the area. + 2: [RID] of the object that entered/exited the area. + 3: Instance ID of the object that entered/exited the area. + 4: The shape index of the object that entered/exited the area. + 5: The shape index of the area where the object entered/exited. @@ -23843,6 +23923,7 @@ This method controls whether the position between two cached points is interpola + Create a physics body. The first parameter can be any value from constants BODY_MODE*, for the type of body created. Additionally, the body can be created in sleeping state to save processing time. @@ -23851,6 +23932,7 @@ This method controls whether the position between two cached points is interpola + Assign a space to the body (see [method create_space]). @@ -23859,6 +23941,7 @@ This method controls whether the position between two cached points is interpola + Return the [RID] of the space assigned to a body. @@ -23867,6 +23950,7 @@ This method controls whether the position between two cached points is interpola + Set the body mode, from one of the constants BODY_MODE*. @@ -23875,6 +23959,7 @@ This method controls whether the position between two cached points is interpola + Return the body mode. @@ -23885,6 +23970,7 @@ This method controls whether the position between two cached points is interpola + Add a shape to the body, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index. @@ -23895,6 +23981,7 @@ This method controls whether the position between two cached points is interpola + Substitute a given body shape by another. The old shape is selected by its index, the new one by its [RID]. @@ -23905,6 +23992,7 @@ This method controls whether the position between two cached points is interpola + Set the transform matrix for a body shape. @@ -23915,6 +24003,7 @@ This method controls whether the position between two cached points is interpola + Set metadata of a shape within a body. This metadata is different from [method Object.set_meta], and can be retrieved on shape queries. @@ -23923,6 +24012,7 @@ This method controls whether the position between two cached points is interpola + Return the number of shapes assigned to a body. @@ -23933,6 +24023,7 @@ This method controls whether the position between two cached points is interpola + Return the [RID] of the nth shape of a body. @@ -23943,14 +24034,18 @@ This method controls whether the position between two cached points is interpola + Return the transform matrix of a body shape. + + + Return the metadata of a shape of a body. @@ -23959,12 +24054,14 @@ This method controls whether the position between two cached points is interpola + Remove a shape from a body. The shape is not deleted, so it can be reused afterwards. + Remove all shapes from a body. @@ -23975,6 +24072,7 @@ This method controls whether the position between two cached points is interpola + Mark a body's shape as a trigger. A trigger shape cannot affect other bodies, but detects other shapes entering and exiting it. @@ -23985,6 +24083,7 @@ This method controls whether the position between two cached points is interpola + Return whether a body's shape is marked as a trigger. @@ -23993,6 +24092,7 @@ This method controls whether the position between two cached points is interpola + Assign the area to a descendant of [Object], so it can exist in the node tree. @@ -24001,6 +24101,7 @@ This method controls whether the position between two cached points is interpola + Get the instance ID of the object the area is assigned to. @@ -24009,6 +24110,8 @@ This method controls whether the position between two cached points is interpola + Set the continuous collision detection mode from any of the CCD_MODE_* constants. + Continuous collision detection tries to predict where a moving body will collide, instead of moving it and correcting its movement if it collided. @@ -24017,6 +24120,7 @@ This method controls whether the position between two cached points is interpola + Return the continuous collision detection mode. @@ -24025,6 +24129,7 @@ This method controls whether the position between two cached points is interpola + Set the physics layer or layers a body belongs to. @@ -24033,6 +24138,7 @@ This method controls whether the position between two cached points is interpola + Return the physics layer or layers a body belongs to. @@ -24041,6 +24147,7 @@ This method controls whether the position between two cached points is interpola + Set the physics layer or layers a body can collide with. @@ -24049,6 +24156,7 @@ This method controls whether the position between two cached points is interpola + Return the physics layer or layers a body can collide with. @@ -24059,6 +24167,7 @@ This method controls whether the position between two cached points is interpola + Set a body parameter (see BODY_PARAM* constants). @@ -24069,6 +24178,7 @@ This method controls whether the position between two cached points is interpola + Return the value of a body parameter. @@ -24079,14 +24189,18 @@ This method controls whether the position between two cached points is interpola + Set a body state (see BODY_STATE* constants). + + + Return a body state. @@ -24097,6 +24211,7 @@ This method controls whether the position between two cached points is interpola + Add a positioned impulse to the applied force and torque. Both the force and the offset from the body origin are in global coordinates. @@ -24105,6 +24220,7 @@ This method controls whether the position between two cached points is interpola + Set an axis velocity. The velocity in the given vector axis will be set as the given vector length. This is useful for jumping behavior. @@ -24113,6 +24229,7 @@ This method controls whether the position between two cached points is interpola + Add a body to the list of bodies exempt from collisions. @@ -24121,6 +24238,7 @@ This method controls whether the position between two cached points is interpola + Remove a body from the list of bodies exempt from collisions. @@ -24129,6 +24247,7 @@ This method controls whether the position between two cached points is interpola + Set the maximum contacts to report. Bodies can keep a log of the contacts with other bodies, this is enabled by setting the maximum amount of contacts reported to a number greater than 0. @@ -24137,6 +24256,7 @@ This method controls whether the position between two cached points is interpola + Return the maximum contacts that can be reported. See [method body_set_max_contacts_reported]. @@ -24145,6 +24265,7 @@ This method controls whether the position between two cached points is interpola + Set a direction in which bodies can go through the given one. If this value is different from (0,0), any movement within 90 degrees of this vector is considered a valid movement. Set this direction to (0,0) to disable one-way collisions. @@ -24153,6 +24274,7 @@ This method controls whether the position between two cached points is interpola + Return the direction used for one-way collision detection. @@ -24161,6 +24283,7 @@ This method controls whether the position between two cached points is interpola + Set how far a body can go through the given one, if it allows one-way collisions (see [method body_set_one_way_collision_direction]). @@ -24169,6 +24292,7 @@ This method controls whether the position between two cached points is interpola + Return how far a body can go through the given one, when it allows one-way collisions. @@ -24177,6 +24301,7 @@ This method controls whether the position between two cached points is interpola + Set whether a body uses a callback function to calculate its own physics (see [method body_set_force_integration_callback]). @@ -24185,6 +24310,7 @@ This method controls whether the position between two cached points is interpola + Return whether a body uses a callback function to calculate its own physics (see [method body_set_force_integration_callback]). @@ -24197,6 +24323,7 @@ This method controls whether the position between two cached points is interpola + Set the function used to calculate physics for an object, if that object allows it (see [method body_set_omit_force integration]). @@ -24211,6 +24338,7 @@ This method controls whether the position between two cached points is interpola + Return whether a body can move in a given direction. Apart from the boolean return value, a [Physics2DTestMotionResult] can be passed to return additional information in. @@ -24221,6 +24349,7 @@ This method controls whether the position between two cached points is interpola + Set a joint parameter. Parameters are explained in the JOINT_PARAM* constants. @@ -24231,6 +24360,7 @@ This method controls whether the position between two cached points is interpola + Return the value of a joint parameter. @@ -24243,6 +24373,7 @@ This method controls whether the position between two cached points is interpola + Create a pin joint between two bodies. If not specified, the second body is assumed to be the joint itself. @@ -24259,6 +24390,7 @@ This method controls whether the position between two cached points is interpola + Create a groove joint between two bodies. If not specified, the bodyies are assumed to be the joint itself. @@ -24273,6 +24405,7 @@ This method controls whether the position between two cached points is interpola + Create a damped spring joint between two bodies. If not specified, the second body is assumed to be the joint itself. @@ -24283,6 +24416,7 @@ This method controls whether the position between two cached points is interpola + Set a damped spring joint parameter. Parameters are explained in the DAMPED_STRING* constants. @@ -24293,6 +24427,7 @@ This method controls whether the position between two cached points is interpola + Return the value of a damped spring joint parameter. @@ -24301,18 +24436,21 @@ This method controls whether the position between two cached points is interpola + Return the type of a joint (see JOINT_* constants). + Destroy any of the objects created by Physics2DServer. If the [RID] passed is not one of the objects that can be created by Physics2DServer, an error will be sent to the console. + Activate or deactivate the 2D physics engine. @@ -24321,41 +24459,79 @@ This method controls whether the position between two cached points is interpola + Return information about the current state of the 2D physics engine. The states are listed under the INFO_* constants. + + Constant to set/get the maximum distance a pair of bodies has to move before their collision status has to be recalculated. + + + Constant to set/get the maximum distance a shape can be from another before they are considered separated. + + + Constant to set/get the maximum distance a shape can penetrate another shape before it is considered a collision. + + + Constant to set/get the linear velocity threshold. Bodies slower than this will be marked as potentially inactive. + + + Constant to set/get the angular velocity threshold. Bodies slower than this will be marked as potentially inactive. + + + Constant to set/get the maximum time of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after this time. + + + Constant to set/get the default solver bias for all physics constraints. A solver bias is a factor controlling how much two objects "rebound", after violating a constraint, to avoid leaving them in that state because of numerical imprecision. + + This is the constant for creating line shapes. A line shape is an infinite line with an origin point, and a normal. Thus, it can be used for front/behind checks. + This is the constant for creating segment shapes. A segment shape is a line from a point A to a point B. It can be checked for intersections. + This is the constant for creating circle shapes. A circle shape only has a radius. It can be used for intersections and inside/outside checks. + This is the constant for creating rectangle shapes. A rectangle shape is defined by a width and a height. It can be used for intersections and inside/outside checks. + This is the constant for creating capsule shapes. A capsule shape is defined by a radius and a length. It can be used for intersections and inside/outside checks. + This is the constant for creating convex polygon shapes. A polygon is defined by a list of points. It can be used for intersections and inside/outside checks. Unlike the method [method CollisionPolygon2D.set_polygon], polygons modified with [method shape_set_data] do not verify that the points supplied form, in fact, a convex polygon. + This is the constant for creating concave polygon shapes. A polygon is defined by a list of points. It can be used for intersections checks, but not for inside/outside checks. + This constant is used internally by the engine. Any attempt to create this kind of shape results in an error. + Constant to set/get gravity strength in an area. + Constant to set/get gravity vector/center in an area. + Constant to set/get whether the gravity vector of an area is a direction, or a center point. + Constant to set/get the falloff factor for point gravity of an area. The greater this value is, the faster the strength of gravity decreases with the square of distance. + This constant was used to set/get the falloff factor for point gravity. It has been superseded by AREA_PARAM_GRAVITY_DISTANCE_SCALE. + Constant to set/get the linear dampening factor of an area. + Constant to set/get the angular dampening factor of an area. + Constant to set/get the priority (order of processing) of an area. This area does not affect gravity/damp. These are generally areas that exist only to detect collisions, and objects entering or exiting them. @@ -24373,71 +24549,112 @@ This method controls whether the position between two cached points is interpola This area replaces any gravity/damp calculated so far, but keeps calculating the rest of the areas, down to the default one. + Constant for static bodies. + Constant for kinematic bodies. + Constant for rigid bodies. + Constant for rigid bodies in character mode. In this mode, a body can not rotate, and only its linear velocity is affected by physics. + Constant to set/get a body's bounce factor. + Constant to set/get a body's friction. + Constant to set/get a body's mass. + Constant to set/get a body's gravity multiplier. + Constant to set/get a body's linear dampening factor. + Constant to set/get a body's angular dampening factor. + This is the last ID for body parameters. Any attempt to set this property is ignored. Any attempt to get it returns 0. + Constant to set/get the current transform matrix of the body. + Constant to set/get the current linear velocity of the body. + Constant to set/get the current angular velocity of the body. + Constant to sleep/wake up a body, or to get whether it is sleeping. + Constant to set/get whether the body can sleep. + Constant to create pin joints. + Constant to create groove joints. + Constant to create damped spring joints. + + + Constant to set/get the solver bias for a joint. + + + Constant to set/get the maximum speed at which a joint can correct its bodies. + + + Constant to set the maximum force a joint can exert on its bodies. + Set the resting length of the spring joint. The joint will always try to go to back this length when pulled apart. + Set the stiffness of the spring joint. The joint applies a force equal to the stiffness times the distance from its resting length. + Set the damping ratio of the spring joint. A value of 0 indicates an undamped spring, while 1 causes the system to reach equilibrium as fast as possible (critical damping). + Disables continuous collision detection. This is the fastest way to detect body collisions, but can miss small, fast-moving objects. + Enables continuous collision detection by raycasting. It is faster than shapecasting, but less precise. + Enables continuous collision detection by shapecasting. It is the slowest CCD method, and the most precise. + The value of the first parameter and area callback function receives, when an object enters one of its shapes. + The value of the first parameter and area callback function receives, when an object exits one of its shapes. + Constant to get the number of objects that are not sleeping. + Constant to get the number of possible collisions. + Constant to get the number of space regions where a collision could occur. + Software implementation of [Physics2DServer]. + Software implementation of [Physics2DServer]. This class exposes no new methods or properties and should not be used, as [Physics2DServer] automatically selects the best implementation available. @@ -24446,98 +24663,115 @@ This method controls whether the position between two cached points is interpola + Parameters to be sent to a 2D shape physics query. + This class contains the shape and other parameters for intersection/collision queries. + Set the [Shape2D] that will be used for collision/intersection queries. + Set the [RID] of the shape to be used in queries. + Return the [RID] of the shape queried. + Set the transormation matrix of the shape. This is necessary to set its position/rotation/scale. + Return the transform matrix of the shape queried. + Set the current movement speed of the shape. + Return the current movement speed of the shape. + Set the collision margin for the shape. A collision margin is an amount (in pixels) that the shape will grow when computing collisions, to account for numerical imprecision. + Return the collision margin for the shape. + Set the physics layer(s) the shape belongs to. + Return the physics layer(s) the shape belongs to. + Set the type of object the shape belongs to (see Physics2DDirectSpaceState.TYPE_MASK_*). + Return the type of object the shape belongs to. + Set the list of objects, or object [RID]s, that will be excluded from collisions. + Return the list of objects, or object [RID]s, that will be excluded from collisions. @@ -26562,143 +26796,147 @@ This method controls whether the position between two cached points is interpola 2D polygon representation - A Polygon2D is defined by a set of n points connected together by line segments, meaning that the point 1 will be connected with point 2, point 2 with point 3 ..., point n-1 with point n and point n with point 1 in order to close the loop and define a plane. + A Polygon2D is defined by a set of n vertices connected together by line segments, meaning that the vertex 1 will be connected with vertex 2, vertex 2 with vertex 3 ..., vertex n-1 with vertex n and vertex n with vertex 1 in order to close the loop and define a polygon. - Defines the set of points that will represent the polygon. + Define the set of vertices that will represent the polygon. - Returns the set of points that defines this polygon + Return the set of vertices that defines this polygon. - Sets the uv value for every point of the polygon + Set the texture coordinates for every vertex of the polygon. There should be one uv vertex for every vertex in the polygon. If there are less, the undefined ones will be assumed to be (0,0). Extra uv vertices are ignored. - Returns the uv value associated with every point of the polygon + Return the texture coordinates associated with every vertex of the polygon. - Sets the polygon fill color, if the polygon has a texture defined, the defined texture will be tinted to the polygon fill color. + Set the polygon fill color. If the polygon has a texture defined, the defined texture will be multiplied by the polygon fill color. This, also, is the default color for those vertices that are not defined by [method get_vertex_colors]. - Returns the polygon fill color + Return the polygon fill color. - Sets the polygon texture. + Set the polygon texture. - Returns the polygon texture + Return the polygon texture - Sets the offset of the polygon texture. Initially the texture will appear anchored to the polygon position, the offset is used to move the texture location away from that point (notice that the texture origin is set to its top left corner, so when offset is 0,0 the top left corner of the texture is at the polygon position), for example setting the offset to 10, 10 will move the texture 10 units to the left and 10 units to the top. + Set the offset of the polygon texture. Initially the texture will appear anchored to the polygon position, the offset is used to move the texture location away from that point (notice that the texture origin is set to its top left corner, so when offset is 0,0 the top left corner of the texture is at the polygon position), for example setting the offset to 10, 10 will move the texture 10 units to the left and 10 units to the top. - Returns the polygon texture offset. + Return the polygon texture offset. - Sets the amount of rotation of the polygon texture, [code]texture_rotation[/code] is specified in radians and clockwise rotation. + Set the amount of rotation of the polygon texture, [code]texture_rotation[/code] is specified in radians and clockwise rotation. - Returns the rotation in radians of the texture polygon. + Return the rotation in radians of the texture polygon. + Set the value that will multiply the uv coordinates ([method get_uv]) when applying the texture. Larger values make the texture smaller, and vice versa. + Return the uv coordinate multiplier. - Sets the polygon as the defined polygon bounding box minus the defined polygon (the defined polygon will appear as a hole on square that contains the defined polygon). + Set the polygon as the defined polygon bounding box minus the defined polygon (the defined polygon will appear as a hole on the square that contains the defined polygon). - Returns whether this polygon is inverted or not + Return whether this polygon is inverted or not. + Add extra padding around the bounding box, making it bigger. Too small a value can make the polygon triangulate strangely, due to numerical imprecision. + Return the added padding around the bounding box. - Sets the amount of distance from the polygon points from the polygon position, for example if the offset is set to 10,10 then all the polygon points will move 10 units to the right and 10 units to the bottom. + Set the an offset that will be added to the vertices' position. E.g. if the offset is set to (10,10) then all the polygon points will move 10 units to the right and 10 units to the bottom. - Returns the polygon points offset to the polygon position. + Return the offset for the polygon vertices. @@ -29485,6 +29723,7 @@ This method controls whether the position between two cached points is interpola Rigid body. This is the "natural" state of a rigid body. It is affected by forces, and can move, rotate, and be affected by user code. + Character body. This behaves like a rigid body, but can not rotate. diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp index fe85b865c43..303e667c95c 100644 --- a/servers/physics_2d_server.cpp +++ b/servers/physics_2d_server.cpp @@ -645,6 +645,14 @@ void Physics2DServer::_bind_methods() { // ObjectTypeDB::bind_method(_MD("sync"),&Physics2DServer::sync); //ObjectTypeDB::bind_method(_MD("flush_queries"),&Physics2DServer::flush_queries); + BIND_CONSTANT( SPACE_PARAM_CONTACT_RECYCLE_RADIUS ); + BIND_CONSTANT( SPACE_PARAM_CONTACT_MAX_SEPARATION ); + BIND_CONSTANT( SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION ); + BIND_CONSTANT( SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_TRESHOLD ); + BIND_CONSTANT( SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_TRESHOLD ); + BIND_CONSTANT( SPACE_PARAM_BODY_TIME_TO_SLEEP ); + BIND_CONSTANT( SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS ); + BIND_CONSTANT( SHAPE_LINE ); BIND_CONSTANT( SHAPE_SEGMENT ); BIND_CONSTANT( SHAPE_CIRCLE );