diff options
author | Ricardo Buring <ricardo.buring@gmail.com> | 2023-08-02 14:57:15 +0200 |
---|---|---|
committer | Ricardo Buring <ricardo.buring@gmail.com> | 2024-03-16 00:32:21 +0100 |
commit | e5632b0243bf3890ecdcca3bd4f9b8825059016d (patch) | |
tree | 2d3fc77e6df208e164fb7a4097e01cbb347a3d45 /doc | |
parent | 006f5bc11c8538fe6c512db2f16ec5cbcd049709 (diff) | |
download | redot-engine-e5632b0243bf3890ecdcca3bd4f9b8825059016d.tar.gz |
Fix force integration documentation
Diffstat (limited to 'doc')
-rw-r--r-- | doc/classes/PhysicalBone3D.xml | 5 | ||||
-rw-r--r-- | doc/classes/PhysicsDirectBodyState2D.xml | 2 | ||||
-rw-r--r-- | doc/classes/PhysicsDirectBodyState3D.xml | 2 | ||||
-rw-r--r-- | doc/classes/PhysicsServer2D.xml | 16 | ||||
-rw-r--r-- | doc/classes/PhysicsServer3D.xml | 14 | ||||
-rw-r--r-- | doc/classes/RigidBody2D.xml | 5 | ||||
-rw-r--r-- | doc/classes/RigidBody3D.xml | 5 |
7 files changed, 29 insertions, 20 deletions
diff --git a/doc/classes/PhysicalBone3D.xml b/doc/classes/PhysicalBone3D.xml index c3b202e0a5..bce1a80526 100644 --- a/doc/classes/PhysicalBone3D.xml +++ b/doc/classes/PhysicalBone3D.xml @@ -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). diff --git a/doc/classes/PhysicsDirectBodyState2D.xml b/doc/classes/PhysicsDirectBodyState2D.xml index 7051663a78..d60cc1ee6b 100644 --- a/doc/classes/PhysicsDirectBodyState2D.xml +++ b/doc/classes/PhysicsDirectBodyState2D.xml @@ -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"> diff --git a/doc/classes/PhysicsDirectBodyState3D.xml b/doc/classes/PhysicsDirectBodyState3D.xml index 42c65763aa..e8c3f3f89d 100644 --- a/doc/classes/PhysicsDirectBodyState3D.xml +++ b/doc/classes/PhysicsDirectBodyState3D.xml @@ -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"> diff --git a/doc/classes/PhysicsServer2D.xml b/doc/classes/PhysicsServer2D.xml index 8be92edbad..d40326fa21 100644 --- a/doc/classes/PhysicsServer2D.xml +++ b/doc/classes/PhysicsServer2D.xml @@ -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"> diff --git a/doc/classes/PhysicsServer3D.xml b/doc/classes/PhysicsServer3D.xml index 4735091f20..1406334438 100644 --- a/doc/classes/PhysicsServer3D.xml +++ b/doc/classes/PhysicsServer3D.xml @@ -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"> diff --git a/doc/classes/RigidBody2D.xml b/doc/classes/RigidBody2D.xml index 269ead1298..e16c83f871 100644 --- a/doc/classes/RigidBody2D.xml +++ b/doc/classes/RigidBody2D.xml @@ -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. diff --git a/doc/classes/RigidBody3D.xml b/doc/classes/RigidBody3D.xml index c507a7c39a..715509a30e 100644 --- a/doc/classes/RigidBody3D.xml +++ b/doc/classes/RigidBody3D.xml @@ -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. |