From ced648ff77e0dc8106fa7351887d0165170d2cf5 Mon Sep 17 00:00:00 2001 From: Mikael Hermansson Date: Sun, 15 Jun 2025 18:36:29 +0200 Subject: [PATCH] Clarify warning in documentation about childing rigid bodies --- doc/classes/RigidBody2D.xml | 3 ++- doc/classes/RigidBody3D.xml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/classes/RigidBody2D.xml b/doc/classes/RigidBody2D.xml index 4b84231db46..b8b42dc2823 100644 --- a/doc/classes/RigidBody2D.xml +++ b/doc/classes/RigidBody2D.xml @@ -7,8 +7,9 @@ [RigidBody2D] implements full 2D physics. It cannot be controlled directly, instead, you must apply forces to it (gravity, impulses, etc.), and the physics simulation will calculate the resulting movement, rotation, react to collisions, and affect other physics bodies in its path. The body's behavior can be adjusted via [member lock_rotation], [member freeze], and [member freeze_mode]. By changing various properties of the object, such as [member mass], you can control how the physics simulation acts on it. A rigid body will always maintain its shape and size, even when forces are applied to it. It is useful for objects that can be interacted with in an environment, such as a tree that can be knocked over or a stack of crates that can be pushed around. + If you need to directly affect the body, prefer [method _integrate_forces] as it allows you to directly access the physics state. If you need to override the default physics behavior, you can write a custom force integration function. See [member custom_integrator]. - [b]Note:[/b] Changing the 2D transform or [member linear_velocity] of a [RigidBody2D] very often may lead to some unpredictable behaviors. If you need to directly affect the body, prefer [method _integrate_forces] as it allows you to directly access the physics state. + [b]Note:[/b] Changing the 2D transform or [member linear_velocity] of a [RigidBody2D] very often may lead to some unpredictable behaviors. This also happens when a [RigidBody2D] is the descendant of a constantly moving node, like another [RigidBody2D], as that will cause its global transform to be set whenever its ancestor moves. https://godotengine.org/asset-library/asset/2725 diff --git a/doc/classes/RigidBody3D.xml b/doc/classes/RigidBody3D.xml index 0fe2a28eb00..24e46158f46 100644 --- a/doc/classes/RigidBody3D.xml +++ b/doc/classes/RigidBody3D.xml @@ -7,8 +7,9 @@ [RigidBody3D] implements full 3D physics. It cannot be controlled directly, instead, you must apply forces to it (gravity, impulses, etc.), and the physics simulation will calculate the resulting movement, rotation, react to collisions, and affect other physics bodies in its path. The body's behavior can be adjusted via [member lock_rotation], [member freeze], and [member freeze_mode]. By changing various properties of the object, such as [member mass], you can control how the physics simulation acts on it. A rigid body will always maintain its shape and size, even when forces are applied to it. It is useful for objects that can be interacted with in an environment, such as a tree that can be knocked over or a stack of crates that can be pushed around. + If you need to directly affect the body, prefer [method _integrate_forces] as it allows you to directly access the physics state. If you need to override the default physics behavior, you can write a custom force integration function. See [member custom_integrator]. - [b]Note:[/b] Changing the 3D transform or [member linear_velocity] of a [RigidBody3D] very often may lead to some unpredictable behaviors. If you need to directly affect the body, prefer [method _integrate_forces] as it allows you to directly access the physics state. + [b]Note:[/b] Changing the 3D transform or [member linear_velocity] of a [RigidBody3D] very often may lead to some unpredictable behaviors. This also happens when a [RigidBody3D] is the descendant of a constantly moving node, like another [RigidBody3D], as that will cause its global transform to be set whenever its ancestor moves. $DOCS_URL/tutorials/physics/physics_introduction.html