diff options
Diffstat (limited to 'doc/classes/PhysicsServer2D.xml')
-rw-r--r-- | doc/classes/PhysicsServer2D.xml | 117 |
1 files changed, 94 insertions, 23 deletions
diff --git a/doc/classes/PhysicsServer2D.xml b/doc/classes/PhysicsServer2D.xml index 868b58ea9f..624f5e7b17 100644 --- a/doc/classes/PhysicsServer2D.xml +++ b/doc/classes/PhysicsServer2D.xml @@ -208,28 +208,39 @@ Sets the transform matrix for an area. </description> </method> - <method name="body_add_central_force"> + <method name="body_add_collision_exception"> <return type="void" /> <argument index="0" name="body" type="RID" /> - <argument index="1" name="force" type="Vector2" /> + <argument index="1" name="excepted_body" type="RID" /> <description> + Adds a body to the list of bodies exempt from collisions. </description> </method> - <method name="body_add_collision_exception"> + <method name="body_add_constant_central_force"> <return type="void" /> <argument index="0" name="body" type="RID" /> - <argument index="1" name="excepted_body" type="RID" /> + <argument index="1" name="force" type="Vector2" /> <description> - Adds a body to the list of bodies exempt from collisions. + Adds a constant directional force without affecting rotation that keeps being applied over time until cleared with [code]body_set_constant_force(body, Vector2(0, 0))[/code]. + This is equivalent to using [method body_add_constant_force] at the body's center of mass. </description> </method> - <method name="body_add_force"> + <method name="body_add_constant_force"> <return type="void" /> <argument index="0" name="body" type="RID" /> <argument index="1" name="force" type="Vector2" /> <argument index="2" name="position" type="Vector2" default="Vector2(0, 0)" /> <description> - Adds a positioned force to the applied force and torque. As with [method body_apply_impulse], both the force and the offset from the body origin are in global coordinates. A force differs from an impulse in that, while the two are forces, the impulse clears itself after being applied. + Adds a constant positioned force to the body that keeps being applied over time until cleared with [code]body_set_constant_force(body, Vector2(0, 0))[/code]. + [code]position[/code] is the offset from the body origin in global coordinates. + </description> + </method> + <method name="body_add_constant_torque"> + <return type="void" /> + <argument index="0" name="body" type="RID" /> + <argument index="1" name="torque" type="float" /> + <description> + Adds a constant rotational force without affecting position that keeps being applied over time until cleared with [code]body_set_constant_torque(body, 0)[/code]. </description> </method> <method name="body_add_shape"> @@ -242,11 +253,13 @@ Adds 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. </description> </method> - <method name="body_add_torque"> + <method name="body_apply_central_force"> <return type="void" /> <argument index="0" name="body" type="RID" /> - <argument index="1" name="torque" type="float" /> + <argument index="1" name="force" type="Vector2" /> <description> + Applies a directional force without affecting rotation. A force is time dependent and meant to be applied every physics update. + This is equivalent to using [method body_apply_force] at the body's center of mass. </description> </method> <method name="body_apply_central_impulse"> @@ -254,6 +267,19 @@ <argument index="0" name="body" type="RID" /> <argument index="1" name="impulse" type="Vector2" /> <description> + Applies a directional impulse without affecting rotation. + An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise). + This is equivalent to using [method body_apply_impulse] at the body's center of mass. + </description> + </method> + <method name="body_apply_force"> + <return type="void" /> + <argument index="0" name="body" type="RID" /> + <argument index="1" name="force" type="Vector2" /> + <argument index="2" name="position" type="Vector2" default="Vector2(0, 0)" /> + <description> + Applies a positioned force to the body. A force is time dependent and meant to be applied every physics update. + [code]position[/code] is the offset from the body origin in global coordinates. </description> </method> <method name="body_apply_impulse"> @@ -262,7 +288,17 @@ <argument index="1" name="impulse" type="Vector2" /> <argument index="2" name="position" type="Vector2" default="Vector2(0, 0)" /> <description> - Adds a positioned impulse to the applied force and torque. Both the force and the offset from the body origin are in global coordinates. + Applies a positioned impulse to the body. + An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise). + [code]position[/code] is the offset from the body origin in global coordinates. + </description> + </method> + <method name="body_apply_torque"> + <return type="void" /> + <argument index="0" name="body" type="RID" /> + <argument index="1" name="torque" type="float" /> + <description> + Applies a rotational force without affecting position. A force is time dependent and meant to be applied every physics update. </description> </method> <method name="body_apply_torque_impulse"> @@ -270,6 +306,8 @@ <argument index="0" name="body" type="RID" /> <argument index="1" name="impulse" type="float" /> <description> + Applies a rotational impulse to the body without affecting the position. + An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise). </description> </method> <method name="body_attach_canvas_instance_id"> @@ -320,6 +358,22 @@ Returns the physics layer or layers a body can collide with. </description> </method> + <method name="body_get_constant_force" qualifiers="const"> + <return type="Vector2" /> + <argument index="0" name="body" type="RID" /> + <description> + Returns the body's total constant positional forces applied during each physics update. + See [method body_add_constant_force] and [method body_add_constant_central_force]. + </description> + </method> + <method name="body_get_constant_torque" qualifiers="const"> + <return type="float" /> + <argument index="0" name="body" type="RID" /> + <description> + Returns the body's total constant rotational forces applied during each physics update. + See [method body_add_constant_torque]. + </description> + </method> <method name="body_get_continuous_collision_detection_mode" qualifiers="const"> <return type="int" enum="PhysicsServer2D.CCDMode" /> <argument index="0" name="body" type="RID" /> @@ -455,6 +509,24 @@ Sets the physics layer or layers a body can collide with. </description> </method> + <method name="body_set_constant_force"> + <return type="void" /> + <argument index="0" name="body" type="RID" /> + <argument index="1" name="force" type="Vector2" /> + <description> + Sets the body's total constant positional forces applied during each physics update. + See [method body_add_constant_force] and [method body_add_constant_central_force]. + </description> + </method> + <method name="body_set_constant_torque"> + <return type="void" /> + <argument index="0" name="body" type="RID" /> + <argument index="1" name="torque" type="float" /> + <description> + Sets the body's total constant rotational forces applied during each physics update. + See [method body_add_constant_torque]. + </description> + </method> <method name="body_set_continuous_collision_detection_mode"> <return type="void" /> <argument index="0" name="body" type="RID" /> @@ -711,13 +783,6 @@ Activates or deactivates the 2D physics engine. </description> </method> - <method name="set_collision_iterations"> - <return type="void" /> - <argument index="0" name="iterations" type="int" /> - <description> - Sets the amount of iterations for calculating velocities of colliding bodies. The greater the amount of iterations, the more accurate the collisions will be. However, a greater amount of iterations requires more CPU power, which can decrease performance. The default value is [code]8[/code]. - </description> - </method> <method name="shape_get_data" qualifiers="const"> <return type="Variant" /> <argument index="0" name="shape" type="RID" /> @@ -796,23 +861,29 @@ Constant to set/get the maximum distance a pair of bodies has to move before their collision status has to be recalculated. </constant> <constant name="SPACE_PARAM_CONTACT_MAX_SEPARATION" value="1" enum="SpaceParameter"> - 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 be from another before they are considered separated and the contact is discarded. </constant> - <constant name="SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION" value="2" enum="SpaceParameter"> + <constant name="SPACE_PARAM_CONTACT_MAX_ALLOWED_PENETRATION" value="2" enum="SpaceParameter"> Constant to set/get the maximum distance a shape can penetrate another shape before it is considered a collision. </constant> - <constant name="SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD" value="3" enum="SpaceParameter"> + <constant name="SPACE_PARAM_CONTACT_DEFAULT_BIAS" value="3" enum="SpaceParameter"> + Constant to set/get the default solver bias for all physics contacts. A solver bias is a factor controlling how much two objects "rebound", after overlapping, to avoid leaving them in that state because of numerical imprecision. + </constant> + <constant name="SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD" value="4" enum="SpaceParameter"> Constant to set/get the threshold linear velocity of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after the time given. </constant> - <constant name="SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD" value="4" enum="SpaceParameter"> + <constant name="SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD" value="5" enum="SpaceParameter"> Constant to set/get the threshold angular velocity of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after the time given. </constant> - <constant name="SPACE_PARAM_BODY_TIME_TO_SLEEP" value="5" enum="SpaceParameter"> + <constant name="SPACE_PARAM_BODY_TIME_TO_SLEEP" value="6" enum="SpaceParameter"> 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> - <constant name="SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS" value="6" enum="SpaceParameter"> + <constant name="SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS" value="7" enum="SpaceParameter"> 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. </constant> + <constant name="SPACE_PARAM_SOLVER_ITERATIONS" value="8" enum="SpaceParameter"> + Constant to set/get the number of solver iterations for all contacts and constraints. The greater the amount of iterations, the more accurate the collisions will be. However, a greater amount of iterations requires more CPU power, which can decrease performance. + </constant> <constant name="SHAPE_WORLD_BOUNDARY" value="0" enum="ShapeType"> This is the constant for creating world boundary shapes. A world boundary shape is an [i]infinite[/i] line with an origin point, and a normal. Thus, it can be used for front/behind checks. </constant> |