summaryrefslogtreecommitdiff
path: root/doc/classes/RigidBody3D.xml
diff options
context:
space:
mode:
authorCamille Mohr-Daurat <pouleyKetchoup@gmail.com>2021-09-06 11:31:15 -0700
committerGitHub <noreply@github.com>2021-09-06 11:31:15 -0700
commitb277c8828089156682abe09b4d0d8077b7298bd2 (patch)
tree3a1d5096b27926ffb19169f96558e75ee448ed85 /doc/classes/RigidBody3D.xml
parente1ae2708ee52f8a0b361ecffd8567f304fad7f76 (diff)
parent82ea2a7045e336bf4ce17358e2057558f89c3ac0 (diff)
Merge pull request #49610 from nekomatata/center-of-mass-calculation
Proper support for custom mass properties in 2D/3D physics bodies
Diffstat (limited to 'doc/classes/RigidBody3D.xml')
-rw-r--r--doc/classes/RigidBody3D.xml17
1 files changed, 17 insertions, 0 deletions
diff --git a/doc/classes/RigidBody3D.xml b/doc/classes/RigidBody3D.xml
index 25fb1edde9..1be35b0576 100644
--- a/doc/classes/RigidBody3D.xml
+++ b/doc/classes/RigidBody3D.xml
@@ -102,6 +102,13 @@
<member name="can_sleep" type="bool" setter="set_can_sleep" getter="is_able_to_sleep" default="true">
If [code]true[/code], the body can enter sleep mode when there is no movement. See [member sleeping].
</member>
+ <member name="center_of_mass" type="Vector3" setter="set_center_of_mass" getter="get_center_of_mass" default="Vector3(0, 0, 0)">
+ The body's custom center of mass, relative to the body's origin position, when [member center_of_mass_mode] is set to [constant CENTER_OF_MASS_MODE_CUSTOM]. This is the balanced point of the body, where applied forces only cause linear acceleration. Applying forces outside of the center of mass causes angular acceleration.
+ When [member center_of_mass_mode] is set to [constant CENTER_OF_MASS_MODE_AUTO] (default value), the center of mass is automatically computed.
+ </member>
+ <member name="center_of_mass_mode" type="int" setter="set_center_of_mass_mode" getter="get_center_of_mass_mode" enum="RigidBody3D.CenterOfMassMode" default="0">
+ Defines the way the body's center of mass is set. See [enum CenterOfMassMode] for possible values.
+ </member>
<member name="contact_monitor" type="bool" setter="set_contact_monitor" getter="is_contact_monitor_enabled" default="false">
If [code]true[/code], the RigidBody3D will emit signals when it collides with another RigidBody3D. See also [member contacts_reported].
</member>
@@ -119,6 +126,10 @@
<member name="gravity_scale" type="float" setter="set_gravity_scale" getter="get_gravity_scale" default="1.0">
This is multiplied by the global 3D gravity setting found in [b]Project &gt; Project Settings &gt; Physics &gt; 3d[/b] to produce RigidBody3D's gravity. For example, a value of 1 will be normal gravity, 2 will apply double gravity, and 0.5 will apply half gravity to this object.
</member>
+ <member name="inertia" type="Vector3" setter="set_inertia" getter="get_inertia" default="Vector3(0, 0, 0)">
+ The body's moment of inertia. This is like mass, but for rotation: it determines how much torque it takes to rotate the body on each axis. The moment of inertia is usually computed automatically from the mass and the shapes, but this property allows you to set a custom value.
+ If set to [code]Vector3.ZERO[/code], inertia is automatically computed (default value).
+ </member>
<member name="linear_damp" type="float" setter="set_linear_damp" getter="get_linear_damp" default="-1.0">
The body's linear damp. Cannot be less than -1.0. If this value is different from -1.0, any linear damp derived from the world or areas will be overridden.
See [member ProjectSettings.physics/3d/default_linear_damp] for more details about damping.
@@ -204,5 +215,11 @@
<constant name="MODE_KINEMATIC" value="3" enum="Mode">
Kinematic body mode. The body behaves like a [AnimatableBody3D], and can only move by user code.
</constant>
+ <constant name="CENTER_OF_MASS_MODE_AUTO" value="0" enum="CenterOfMassMode">
+ In this mode, the body's center of mass is calculated automatically based on its shapes.
+ </constant>
+ <constant name="CENTER_OF_MASS_MODE_CUSTOM" value="1" enum="CenterOfMassMode">
+ In this mode, the body's center of mass is set through [member center_of_mass]. Defaults to the body's origin position.
+ </constant>
</constants>
</class>