mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 03:18:37 +08:00
Fix force integration documentation
This commit is contained in:
parent
006f5bc11c
commit
e5632b0243
@ -13,7 +13,7 @@
|
||||
<return type="void" />
|
||||
<param index="0" name="state" type="PhysicsDirectBodyState3D" />
|
||||
<description>
|
||||
Called during physics processing, allowing you to read and safely modify the simulation state for the object. By default, it works in addition to the usual physics behavior, but the [member custom_integrator] property allows you to disable the default behavior and do fully custom force integration for a body.
|
||||
Called during physics processing, allowing you to read and safely modify the simulation state for the object. By default, it is called before the standard force integration, but the [member custom_integrator] property allows you to disable the standard force integration and do fully custom force integration for a body.
|
||||
</description>
|
||||
</method>
|
||||
<method name="apply_central_impulse">
|
||||
@ -67,7 +67,8 @@
|
||||
If [code]true[/code], the body is deactivated when there is no movement, so it will not take part in the simulation until it is awakened by an external force.
|
||||
</member>
|
||||
<member name="custom_integrator" type="bool" setter="set_use_custom_integrator" getter="is_using_custom_integrator" default="false">
|
||||
If [code]true[/code], internal force integration will be disabled (like gravity or air friction) for this body. Other than collision response, the body will only move as determined by the [method _integrate_forces] function, if defined.
|
||||
If [code]true[/code], the standard force integration (like gravity or damping) will be disabled for this body. Other than collision response, the body will only move as determined by the [method _integrate_forces] method, if that virtual method is overridden.
|
||||
Setting this property will call the method [method PhysicsServer3D.body_set_omit_force_integration] internally.
|
||||
</member>
|
||||
<member name="friction" type="float" setter="set_friction" getter="get_friction" default="1.0">
|
||||
The body's friction, from [code]0[/code] (frictionless) to [code]1[/code] (max friction).
|
||||
|
@ -202,7 +202,7 @@
|
||||
<method name="integrate_forces">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Calls the built-in force integration code.
|
||||
Updates the body's linear and angular velocity by applying gravity and damping for the equivalent of one physics tick.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_constant_force">
|
||||
|
@ -202,7 +202,7 @@
|
||||
<method name="integrate_forces">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Calls the built-in force integration code.
|
||||
Updates the body's linear and angular velocity by applying gravity and damping for the equivalent of one physics tick.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_constant_force">
|
||||
|
@ -501,7 +501,7 @@
|
||||
<return type="bool" />
|
||||
<param index="0" name="body" type="RID" />
|
||||
<description>
|
||||
Returns [code]true[/code] if the body uses a callback function to calculate its own physics (see [method body_set_force_integration_callback]).
|
||||
Returns [code]true[/code] if the body is omitting the standard force integration. See [method body_set_omit_force_integration].
|
||||
</description>
|
||||
</method>
|
||||
<method name="body_remove_collision_exception">
|
||||
@ -592,11 +592,12 @@
|
||||
<param index="1" name="callable" type="Callable" />
|
||||
<param index="2" name="userdata" type="Variant" default="null" />
|
||||
<description>
|
||||
Sets the function used to calculate physics for the body, if that body allows it (see [method body_set_omit_force_integration]).
|
||||
The force integration function takes the following two parameters:
|
||||
1. a [PhysicsDirectBodyState2D] [code]state[/code]: used to retrieve and modify the body's state,
|
||||
2. a [Variant] [param userdata]: optional user data.
|
||||
[b]Note:[/b] This callback is currently not called in Godot Physics.
|
||||
Sets the body's custom force integration callback function to [param callable]. Use an empty [Callable] ([code skip-lint]Callable()[/code]) to clear the custom callback.
|
||||
The function [param callable] will be called every physics tick, before the standard force integration (see [method body_set_omit_force_integration]). It can be used for example to update the body's linear and angular velocity based on contact with other bodies.
|
||||
If [param userdata] is not [code]null[/code], the function [param callable] must take the following two parameters:
|
||||
1. [code]state[/code]: a [PhysicsDirectBodyState2D] used to retrieve and modify the body's state,
|
||||
2. [code skip-lint]userdata[/code]: a [Variant]; its value will be the [param userdata] passed into this method.
|
||||
If [param userdata] is [code]null[/code], then [param callable] must take only the [code]state[/code] parameter.
|
||||
</description>
|
||||
</method>
|
||||
<method name="body_set_max_contacts_reported">
|
||||
@ -620,7 +621,8 @@
|
||||
<param index="0" name="body" type="RID" />
|
||||
<param index="1" name="enable" type="bool" />
|
||||
<description>
|
||||
Sets whether the body uses a callback function to calculate its own physics (see [method body_set_force_integration_callback]).
|
||||
Sets whether the body omits the standard force integration. If [param enable] is [code]true[/code], the body will not automatically use applied forces, torques, and damping to update the body's linear and angular velocity. In this case, [method body_set_force_integration_callback] can be used to manually update the linear and angular velocity instead.
|
||||
This method is called when the property [member RigidBody2D.custom_integrator] is set.
|
||||
</description>
|
||||
</method>
|
||||
<method name="body_set_param">
|
||||
|
@ -482,7 +482,7 @@
|
||||
<return type="bool" />
|
||||
<param index="0" name="body" type="RID" />
|
||||
<description>
|
||||
Returns whether a body uses a callback function to calculate its own physics (see [method body_set_force_integration_callback]).
|
||||
Returns [code]true[/code] if the body is omitting the standard force integration. See [method body_set_omit_force_integration].
|
||||
</description>
|
||||
</method>
|
||||
<method name="body_remove_collision_exception">
|
||||
@ -582,9 +582,12 @@
|
||||
<param index="1" name="callable" type="Callable" />
|
||||
<param index="2" name="userdata" type="Variant" default="null" />
|
||||
<description>
|
||||
Sets the function used to calculate physics for an object, if that object allows it (see [method body_set_omit_force_integration]). The force integration function takes 2 arguments:
|
||||
- [code]state[/code] — [PhysicsDirectBodyState3D] used to retrieve and modify the body's state.
|
||||
- [code skip-lint]userdata[/code] — optional user data passed to [method body_set_force_integration_callback].
|
||||
Sets the body's custom force integration callback function to [param callable]. Use an empty [Callable] ([code skip-lint]Callable()[/code]) to clear the custom callback.
|
||||
The function [param callable] will be called every physics tick, before the standard force integration (see [method body_set_omit_force_integration]). It can be used for example to update the body's linear and angular velocity based on contact with other bodies.
|
||||
If [param userdata] is not [code]null[/code], the function [param callable] must take the following two parameters:
|
||||
1. [code]state[/code]: a [PhysicsDirectBodyState3D], used to retrieve and modify the body's state,
|
||||
2. [code skip-lint]userdata[/code]: a [Variant]; its value will be the [param userdata] passed into this method.
|
||||
If [param userdata] is [code]null[/code], then [param callable] must take only the [code]state[/code] parameter.
|
||||
</description>
|
||||
</method>
|
||||
<method name="body_set_max_contacts_reported">
|
||||
@ -608,7 +611,8 @@
|
||||
<param index="0" name="body" type="RID" />
|
||||
<param index="1" name="enable" type="bool" />
|
||||
<description>
|
||||
Sets whether a body uses a callback function to calculate its own physics (see [method body_set_force_integration_callback]).
|
||||
Sets whether the body omits the standard force integration. If [param enable] is [code]true[/code], the body will not automatically use applied forces, torques, and damping to update the body's linear and angular velocity. In this case, [method body_set_force_integration_callback] can be used to manually update the linear and angular velocity instead.
|
||||
This method is called when the property [member RigidBody3D.custom_integrator] is set.
|
||||
</description>
|
||||
</method>
|
||||
<method name="body_set_param">
|
||||
|
@ -19,7 +19,7 @@
|
||||
<return type="void" />
|
||||
<param index="0" name="state" type="PhysicsDirectBodyState2D" />
|
||||
<description>
|
||||
Allows you to read and safely modify the simulation state for the object. Use this instead of [method Node._physics_process] if you need to directly change the body's [code]position[/code] or other physics properties. By default, it works in addition to the usual physics behavior, but [member custom_integrator] allows you to disable the default behavior and write custom force integration for a body.
|
||||
Called during physics processing, allowing you to read and safely modify the simulation state for the object. By default, it is called before the standard force integration, but the [member custom_integrator] property allows you to disable the standard force integration and do fully custom force integration for a body.
|
||||
</description>
|
||||
</method>
|
||||
<method name="add_constant_central_force">
|
||||
@ -159,7 +159,8 @@
|
||||
Continuous collision detection tries to predict where a moving body will collide instead of moving it and correcting its movement after collision. Continuous collision detection is slower, but more precise and misses fewer collisions with small, fast-moving objects. Raycasting and shapecasting methods are available. See [enum CCDMode] for details.
|
||||
</member>
|
||||
<member name="custom_integrator" type="bool" setter="set_use_custom_integrator" getter="is_using_custom_integrator" default="false">
|
||||
If [code]true[/code], internal force integration is disabled for this body. Aside from collision response, the body will only move as determined by the [method _integrate_forces] function.
|
||||
If [code]true[/code], the standard force integration (like gravity or damping) will be disabled for this body. Other than collision response, the body will only move as determined by the [method _integrate_forces] method, if that virtual method is overridden.
|
||||
Setting this property will call the method [method PhysicsServer2D.body_set_omit_force_integration] internally.
|
||||
</member>
|
||||
<member name="freeze" type="bool" setter="set_freeze_enabled" getter="is_freeze_enabled" default="false">
|
||||
If [code]true[/code], the body is frozen. Gravity and forces are not applied anymore.
|
||||
|
@ -20,7 +20,7 @@
|
||||
<return type="void" />
|
||||
<param index="0" name="state" type="PhysicsDirectBodyState3D" />
|
||||
<description>
|
||||
Called during physics processing, allowing you to read and safely modify the simulation state for the object. By default, it works in addition to the usual physics behavior, but the [member custom_integrator] property allows you to disable the default behavior and do fully custom force integration for a body.
|
||||
Called during physics processing, allowing you to read and safely modify the simulation state for the object. By default, it is called before the standard force integration, but the [member custom_integrator] property allows you to disable the standard force integration and do fully custom force integration for a body.
|
||||
</description>
|
||||
</method>
|
||||
<method name="add_constant_central_force">
|
||||
@ -166,7 +166,8 @@
|
||||
Continuous collision detection tries to predict where a moving body will collide, instead of moving it and correcting its movement if it collided. Continuous collision detection is more precise, and misses fewer impacts by small, fast-moving objects. Not using continuous collision detection is faster to compute, but can miss small, fast-moving objects.
|
||||
</member>
|
||||
<member name="custom_integrator" type="bool" setter="set_use_custom_integrator" getter="is_using_custom_integrator" default="false">
|
||||
If [code]true[/code], internal force integration will be disabled (like gravity or air friction) for this body. Other than collision response, the body will only move as determined by the [method _integrate_forces] function, if defined.
|
||||
If [code]true[/code], the standard force integration (like gravity or damping) will be disabled for this body. Other than collision response, the body will only move as determined by the [method _integrate_forces] method, if that virtual method is overridden.
|
||||
Setting this property will call the method [method PhysicsServer3D.body_set_omit_force_integration] internally.
|
||||
</member>
|
||||
<member name="freeze" type="bool" setter="set_freeze_enabled" getter="is_freeze_enabled" default="false">
|
||||
If [code]true[/code], the body is frozen. Gravity and forces are not applied anymore.
|
||||
|
Loading…
Reference in New Issue
Block a user