From 45e596e02ff763f35d227f2a3de1d44875372816 Mon Sep 17 00:00:00 2001 From: skyace65 Date: Thu, 27 Aug 2020 09:57:03 -0400 Subject: [PATCH] Document where the center of mass is for RigidBody nodes (cherry picked from commit 555f4f3e17a16d1d796691e2d83b17fe75ac67ae) --- doc/classes/RigidBody.xml | 1 + doc/classes/RigidBody2D.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/doc/classes/RigidBody.xml b/doc/classes/RigidBody.xml index feb445ab36d..e525ae00a73 100644 --- a/doc/classes/RigidBody.xml +++ b/doc/classes/RigidBody.xml @@ -8,6 +8,7 @@ A RigidBody has 4 behavior [member mode]s: Rigid, Static, Character, and Kinematic. [b]Note:[/b] Don't change a RigidBody's position every frame or very often. Sporadic changes work fine, but physics runs at a different granularity (fixed Hz) than usual rendering (process callback) and maybe even in a separate thread, so changing this from a process loop may result in strange behavior. If you need to directly affect the body's state, use [method _integrate_forces], which 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]. + With Bullet physics (the default), the center of mass is the RigidBody3D center. With GodotPhysics, the center of mass is the average of the [CollisionShape] centers. https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html diff --git a/doc/classes/RigidBody2D.xml b/doc/classes/RigidBody2D.xml index 415769e3105..3e93bb8e3ad 100644 --- a/doc/classes/RigidBody2D.xml +++ b/doc/classes/RigidBody2D.xml @@ -9,6 +9,7 @@ [b]Note:[/b] You should not change a RigidBody2D's [code]position[/code] or [code]linear_velocity[/code] every frame or even very often. If you need to directly affect the body's state, use [method _integrate_forces], which allows you to directly access the physics state. Please also keep in mind that physics bodies manage their own transform which overwrites the ones you set. So any direct or indirect transformation (including scaling of the node or its parent) will be visible in the editor only, and immediately reset at runtime. If you need to override the default physics behavior or add a transformation at runtime, you can write a custom force integration. See [member custom_integrator]. + The center of mass is always located at the node's origin without taking into account the [CollisionShape2D] centroid offsets.