class_rigidbody3d.rst 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/RigidBody3D.xml.
  6. .. _class_RigidBody3D:
  7. RigidBody3D
  8. ===========
  9. **Inherits:** :ref:`PhysicsBody3D<class_PhysicsBody3D>` **<** :ref:`CollisionObject3D<class_CollisionObject3D>` **<** :ref:`Node3D<class_Node3D>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`VehicleBody3D<class_VehicleBody3D>`
  11. A 3D physics body that is moved by a physics simulation.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. **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.
  16. The body's behavior can be adjusted via :ref:`lock_rotation<class_RigidBody3D_property_lock_rotation>`, :ref:`freeze<class_RigidBody3D_property_freeze>`, and :ref:`freeze_mode<class_RigidBody3D_property_freeze_mode>`. By changing various properties of the object, such as :ref:`mass<class_RigidBody3D_property_mass>`, you can control how the physics simulation acts on it.
  17. 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.
  18. If you need to directly affect the body, prefer :ref:`_integrate_forces()<class_RigidBody3D_private_method__integrate_forces>` as it allows you to directly access the physics state.
  19. If you need to override the default physics behavior, you can write a custom force integration function. See :ref:`custom_integrator<class_RigidBody3D_property_custom_integrator>`.
  20. \ **Note:** Changing the 3D transform or :ref:`linear_velocity<class_RigidBody3D_property_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.
  21. .. rst-class:: classref-introduction-group
  22. Tutorials
  23. ---------
  24. - :doc:`Physics introduction <../tutorials/physics/physics_introduction>`
  25. - `3D Truck Town Demo <https://godotengine.org/asset-library/asset/2752>`__
  26. - `3D Physics Tests Demo <https://godotengine.org/asset-library/asset/2747>`__
  27. .. rst-class:: classref-reftable-group
  28. Properties
  29. ----------
  30. .. table::
  31. :widths: auto
  32. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  33. | :ref:`float<class_float>` | :ref:`angular_damp<class_RigidBody3D_property_angular_damp>` | ``0.0`` |
  34. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  35. | :ref:`DampMode<enum_RigidBody3D_DampMode>` | :ref:`angular_damp_mode<class_RigidBody3D_property_angular_damp_mode>` | ``0`` |
  36. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  37. | :ref:`Vector3<class_Vector3>` | :ref:`angular_velocity<class_RigidBody3D_property_angular_velocity>` | ``Vector3(0, 0, 0)`` |
  38. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  39. | :ref:`bool<class_bool>` | :ref:`can_sleep<class_RigidBody3D_property_can_sleep>` | ``true`` |
  40. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  41. | :ref:`Vector3<class_Vector3>` | :ref:`center_of_mass<class_RigidBody3D_property_center_of_mass>` | ``Vector3(0, 0, 0)`` |
  42. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  43. | :ref:`CenterOfMassMode<enum_RigidBody3D_CenterOfMassMode>` | :ref:`center_of_mass_mode<class_RigidBody3D_property_center_of_mass_mode>` | ``0`` |
  44. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  45. | :ref:`Vector3<class_Vector3>` | :ref:`constant_force<class_RigidBody3D_property_constant_force>` | ``Vector3(0, 0, 0)`` |
  46. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  47. | :ref:`Vector3<class_Vector3>` | :ref:`constant_torque<class_RigidBody3D_property_constant_torque>` | ``Vector3(0, 0, 0)`` |
  48. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  49. | :ref:`bool<class_bool>` | :ref:`contact_monitor<class_RigidBody3D_property_contact_monitor>` | ``false`` |
  50. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  51. | :ref:`bool<class_bool>` | :ref:`continuous_cd<class_RigidBody3D_property_continuous_cd>` | ``false`` |
  52. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  53. | :ref:`bool<class_bool>` | :ref:`custom_integrator<class_RigidBody3D_property_custom_integrator>` | ``false`` |
  54. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  55. | :ref:`bool<class_bool>` | :ref:`freeze<class_RigidBody3D_property_freeze>` | ``false`` |
  56. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  57. | :ref:`FreezeMode<enum_RigidBody3D_FreezeMode>` | :ref:`freeze_mode<class_RigidBody3D_property_freeze_mode>` | ``0`` |
  58. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  59. | :ref:`float<class_float>` | :ref:`gravity_scale<class_RigidBody3D_property_gravity_scale>` | ``1.0`` |
  60. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  61. | :ref:`Vector3<class_Vector3>` | :ref:`inertia<class_RigidBody3D_property_inertia>` | ``Vector3(0, 0, 0)`` |
  62. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  63. | :ref:`float<class_float>` | :ref:`linear_damp<class_RigidBody3D_property_linear_damp>` | ``0.0`` |
  64. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  65. | :ref:`DampMode<enum_RigidBody3D_DampMode>` | :ref:`linear_damp_mode<class_RigidBody3D_property_linear_damp_mode>` | ``0`` |
  66. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  67. | :ref:`Vector3<class_Vector3>` | :ref:`linear_velocity<class_RigidBody3D_property_linear_velocity>` | ``Vector3(0, 0, 0)`` |
  68. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  69. | :ref:`bool<class_bool>` | :ref:`lock_rotation<class_RigidBody3D_property_lock_rotation>` | ``false`` |
  70. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  71. | :ref:`float<class_float>` | :ref:`mass<class_RigidBody3D_property_mass>` | ``1.0`` |
  72. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  73. | :ref:`int<class_int>` | :ref:`max_contacts_reported<class_RigidBody3D_property_max_contacts_reported>` | ``0`` |
  74. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  75. | :ref:`PhysicsMaterial<class_PhysicsMaterial>` | :ref:`physics_material_override<class_RigidBody3D_property_physics_material_override>` | |
  76. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  77. | :ref:`bool<class_bool>` | :ref:`sleeping<class_RigidBody3D_property_sleeping>` | ``false`` |
  78. +------------------------------------------------------------+----------------------------------------------------------------------------------------+----------------------+
  79. .. rst-class:: classref-reftable-group
  80. Methods
  81. -------
  82. .. table::
  83. :widths: auto
  84. +----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | |void| | :ref:`_integrate_forces<class_RigidBody3D_private_method__integrate_forces>`\ (\ state\: :ref:`PhysicsDirectBodyState3D<class_PhysicsDirectBodyState3D>`\ ) |virtual| |
  86. +----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | |void| | :ref:`add_constant_central_force<class_RigidBody3D_method_add_constant_central_force>`\ (\ force\: :ref:`Vector3<class_Vector3>`\ ) |
  88. +----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | |void| | :ref:`add_constant_force<class_RigidBody3D_method_add_constant_force>`\ (\ force\: :ref:`Vector3<class_Vector3>`, position\: :ref:`Vector3<class_Vector3>` = Vector3(0, 0, 0)\ ) |
  90. +----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | |void| | :ref:`add_constant_torque<class_RigidBody3D_method_add_constant_torque>`\ (\ torque\: :ref:`Vector3<class_Vector3>`\ ) |
  92. +----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | |void| | :ref:`apply_central_force<class_RigidBody3D_method_apply_central_force>`\ (\ force\: :ref:`Vector3<class_Vector3>`\ ) |
  94. +----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | |void| | :ref:`apply_central_impulse<class_RigidBody3D_method_apply_central_impulse>`\ (\ impulse\: :ref:`Vector3<class_Vector3>`\ ) |
  96. +----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | |void| | :ref:`apply_force<class_RigidBody3D_method_apply_force>`\ (\ force\: :ref:`Vector3<class_Vector3>`, position\: :ref:`Vector3<class_Vector3>` = Vector3(0, 0, 0)\ ) |
  98. +----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | |void| | :ref:`apply_impulse<class_RigidBody3D_method_apply_impulse>`\ (\ impulse\: :ref:`Vector3<class_Vector3>`, position\: :ref:`Vector3<class_Vector3>` = Vector3(0, 0, 0)\ ) |
  100. +----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | |void| | :ref:`apply_torque<class_RigidBody3D_method_apply_torque>`\ (\ torque\: :ref:`Vector3<class_Vector3>`\ ) |
  102. +----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | |void| | :ref:`apply_torque_impulse<class_RigidBody3D_method_apply_torque_impulse>`\ (\ impulse\: :ref:`Vector3<class_Vector3>`\ ) |
  104. +----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | :ref:`Array<class_Array>`\[:ref:`Node3D<class_Node3D>`\] | :ref:`get_colliding_bodies<class_RigidBody3D_method_get_colliding_bodies>`\ (\ ) |const| |
  106. +----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. | :ref:`int<class_int>` | :ref:`get_contact_count<class_RigidBody3D_method_get_contact_count>`\ (\ ) |const| |
  108. +----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  109. | :ref:`Basis<class_Basis>` | :ref:`get_inverse_inertia_tensor<class_RigidBody3D_method_get_inverse_inertia_tensor>`\ (\ ) |const| |
  110. +----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  111. | |void| | :ref:`set_axis_velocity<class_RigidBody3D_method_set_axis_velocity>`\ (\ axis_velocity\: :ref:`Vector3<class_Vector3>`\ ) |
  112. +----------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  113. .. rst-class:: classref-section-separator
  114. ----
  115. .. rst-class:: classref-descriptions-group
  116. Signals
  117. -------
  118. .. _class_RigidBody3D_signal_body_entered:
  119. .. rst-class:: classref-signal
  120. **body_entered**\ (\ body\: :ref:`Node<class_Node>`\ ) :ref:`๐Ÿ”—<class_RigidBody3D_signal_body_entered>`
  121. Emitted when a collision with another :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`GridMap<class_GridMap>` occurs. Requires :ref:`contact_monitor<class_RigidBody3D_property_contact_monitor>` to be set to ``true`` and :ref:`max_contacts_reported<class_RigidBody3D_property_max_contacts_reported>` to be set high enough to detect all the collisions. :ref:`GridMap<class_GridMap>`\ s are detected if the :ref:`MeshLibrary<class_MeshLibrary>` has Collision :ref:`Shape3D<class_Shape3D>`\ s.
  122. \ ``body`` the :ref:`Node<class_Node>`, if it exists in the tree, of the other :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`GridMap<class_GridMap>`.
  123. .. rst-class:: classref-item-separator
  124. ----
  125. .. _class_RigidBody3D_signal_body_exited:
  126. .. rst-class:: classref-signal
  127. **body_exited**\ (\ body\: :ref:`Node<class_Node>`\ ) :ref:`๐Ÿ”—<class_RigidBody3D_signal_body_exited>`
  128. Emitted when the collision with another :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`GridMap<class_GridMap>` ends. Requires :ref:`contact_monitor<class_RigidBody3D_property_contact_monitor>` to be set to ``true`` and :ref:`max_contacts_reported<class_RigidBody3D_property_max_contacts_reported>` to be set high enough to detect all the collisions. :ref:`GridMap<class_GridMap>`\ s are detected if the :ref:`MeshLibrary<class_MeshLibrary>` has Collision :ref:`Shape3D<class_Shape3D>`\ s.
  129. \ ``body`` the :ref:`Node<class_Node>`, if it exists in the tree, of the other :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`GridMap<class_GridMap>`.
  130. .. rst-class:: classref-item-separator
  131. ----
  132. .. _class_RigidBody3D_signal_body_shape_entered:
  133. .. rst-class:: classref-signal
  134. **body_shape_entered**\ (\ body_rid\: :ref:`RID<class_RID>`, body\: :ref:`Node<class_Node>`, body_shape_index\: :ref:`int<class_int>`, local_shape_index\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_RigidBody3D_signal_body_shape_entered>`
  135. Emitted when one of this RigidBody3D's :ref:`Shape3D<class_Shape3D>`\ s collides with another :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`GridMap<class_GridMap>`'s :ref:`Shape3D<class_Shape3D>`\ s. Requires :ref:`contact_monitor<class_RigidBody3D_property_contact_monitor>` to be set to ``true`` and :ref:`max_contacts_reported<class_RigidBody3D_property_max_contacts_reported>` to be set high enough to detect all the collisions. :ref:`GridMap<class_GridMap>`\ s are detected if the :ref:`MeshLibrary<class_MeshLibrary>` has Collision :ref:`Shape3D<class_Shape3D>`\ s.
  136. \ ``body_rid`` the :ref:`RID<class_RID>` of the other :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`MeshLibrary<class_MeshLibrary>`'s :ref:`CollisionObject3D<class_CollisionObject3D>` used by the :ref:`PhysicsServer3D<class_PhysicsServer3D>`.
  137. \ ``body`` the :ref:`Node<class_Node>`, if it exists in the tree, of the other :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`GridMap<class_GridMap>`.
  138. \ ``body_shape_index`` the index of the :ref:`Shape3D<class_Shape3D>` of the other :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`GridMap<class_GridMap>` used by the :ref:`PhysicsServer3D<class_PhysicsServer3D>`. Get the :ref:`CollisionShape3D<class_CollisionShape3D>` node with ``body.shape_owner_get_owner(body.shape_find_owner(body_shape_index))``.
  139. \ ``local_shape_index`` the index of the :ref:`Shape3D<class_Shape3D>` of this RigidBody3D used by the :ref:`PhysicsServer3D<class_PhysicsServer3D>`. Get the :ref:`CollisionShape3D<class_CollisionShape3D>` node with ``self.shape_owner_get_owner(self.shape_find_owner(local_shape_index))``.
  140. .. rst-class:: classref-item-separator
  141. ----
  142. .. _class_RigidBody3D_signal_body_shape_exited:
  143. .. rst-class:: classref-signal
  144. **body_shape_exited**\ (\ body_rid\: :ref:`RID<class_RID>`, body\: :ref:`Node<class_Node>`, body_shape_index\: :ref:`int<class_int>`, local_shape_index\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_RigidBody3D_signal_body_shape_exited>`
  145. Emitted when the collision between one of this RigidBody3D's :ref:`Shape3D<class_Shape3D>`\ s and another :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`GridMap<class_GridMap>`'s :ref:`Shape3D<class_Shape3D>`\ s ends. Requires :ref:`contact_monitor<class_RigidBody3D_property_contact_monitor>` to be set to ``true`` and :ref:`max_contacts_reported<class_RigidBody3D_property_max_contacts_reported>` to be set high enough to detect all the collisions. :ref:`GridMap<class_GridMap>`\ s are detected if the :ref:`MeshLibrary<class_MeshLibrary>` has Collision :ref:`Shape3D<class_Shape3D>`\ s.
  146. \ ``body_rid`` the :ref:`RID<class_RID>` of the other :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`MeshLibrary<class_MeshLibrary>`'s :ref:`CollisionObject3D<class_CollisionObject3D>` used by the :ref:`PhysicsServer3D<class_PhysicsServer3D>`. :ref:`GridMap<class_GridMap>`\ s are detected if the Meshes have :ref:`Shape3D<class_Shape3D>`\ s.
  147. \ ``body`` the :ref:`Node<class_Node>`, if it exists in the tree, of the other :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`GridMap<class_GridMap>`.
  148. \ ``body_shape_index`` the index of the :ref:`Shape3D<class_Shape3D>` of the other :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`GridMap<class_GridMap>` used by the :ref:`PhysicsServer3D<class_PhysicsServer3D>`. Get the :ref:`CollisionShape3D<class_CollisionShape3D>` node with ``body.shape_owner_get_owner(body.shape_find_owner(body_shape_index))``.
  149. \ ``local_shape_index`` the index of the :ref:`Shape3D<class_Shape3D>` of this RigidBody3D used by the :ref:`PhysicsServer3D<class_PhysicsServer3D>`. Get the :ref:`CollisionShape3D<class_CollisionShape3D>` node with ``self.shape_owner_get_owner(self.shape_find_owner(local_shape_index))``.
  150. .. rst-class:: classref-item-separator
  151. ----
  152. .. _class_RigidBody3D_signal_sleeping_state_changed:
  153. .. rst-class:: classref-signal
  154. **sleeping_state_changed**\ (\ ) :ref:`๐Ÿ”—<class_RigidBody3D_signal_sleeping_state_changed>`
  155. Emitted when the physics engine changes the body's sleeping state.
  156. \ **Note:** Changing the value :ref:`sleeping<class_RigidBody3D_property_sleeping>` will not trigger this signal. It is only emitted if the sleeping state is changed by the physics engine or ``emit_signal("sleeping_state_changed")`` is used.
  157. .. rst-class:: classref-section-separator
  158. ----
  159. .. rst-class:: classref-descriptions-group
  160. Enumerations
  161. ------------
  162. .. _enum_RigidBody3D_FreezeMode:
  163. .. rst-class:: classref-enumeration
  164. enum **FreezeMode**: :ref:`๐Ÿ”—<enum_RigidBody3D_FreezeMode>`
  165. .. _class_RigidBody3D_constant_FREEZE_MODE_STATIC:
  166. .. rst-class:: classref-enumeration-constant
  167. :ref:`FreezeMode<enum_RigidBody3D_FreezeMode>` **FREEZE_MODE_STATIC** = ``0``
  168. Static body freeze mode (default). The body is not affected by gravity and forces. It can be only moved by user code and doesn't collide with other bodies along its path.
  169. .. _class_RigidBody3D_constant_FREEZE_MODE_KINEMATIC:
  170. .. rst-class:: classref-enumeration-constant
  171. :ref:`FreezeMode<enum_RigidBody3D_FreezeMode>` **FREEZE_MODE_KINEMATIC** = ``1``
  172. Kinematic body freeze mode. Similar to :ref:`FREEZE_MODE_STATIC<class_RigidBody3D_constant_FREEZE_MODE_STATIC>`, but collides with other bodies along its path when moved. Useful for a frozen body that needs to be animated.
  173. .. rst-class:: classref-item-separator
  174. ----
  175. .. _enum_RigidBody3D_CenterOfMassMode:
  176. .. rst-class:: classref-enumeration
  177. enum **CenterOfMassMode**: :ref:`๐Ÿ”—<enum_RigidBody3D_CenterOfMassMode>`
  178. .. _class_RigidBody3D_constant_CENTER_OF_MASS_MODE_AUTO:
  179. .. rst-class:: classref-enumeration-constant
  180. :ref:`CenterOfMassMode<enum_RigidBody3D_CenterOfMassMode>` **CENTER_OF_MASS_MODE_AUTO** = ``0``
  181. In this mode, the body's center of mass is calculated automatically based on its shapes. This assumes that the shapes' origins are also their center of mass.
  182. .. _class_RigidBody3D_constant_CENTER_OF_MASS_MODE_CUSTOM:
  183. .. rst-class:: classref-enumeration-constant
  184. :ref:`CenterOfMassMode<enum_RigidBody3D_CenterOfMassMode>` **CENTER_OF_MASS_MODE_CUSTOM** = ``1``
  185. In this mode, the body's center of mass is set through :ref:`center_of_mass<class_RigidBody3D_property_center_of_mass>`. Defaults to the body's origin position.
  186. .. rst-class:: classref-item-separator
  187. ----
  188. .. _enum_RigidBody3D_DampMode:
  189. .. rst-class:: classref-enumeration
  190. enum **DampMode**: :ref:`๐Ÿ”—<enum_RigidBody3D_DampMode>`
  191. .. _class_RigidBody3D_constant_DAMP_MODE_COMBINE:
  192. .. rst-class:: classref-enumeration-constant
  193. :ref:`DampMode<enum_RigidBody3D_DampMode>` **DAMP_MODE_COMBINE** = ``0``
  194. In this mode, the body's damping value is added to any value set in areas or the default value.
  195. .. _class_RigidBody3D_constant_DAMP_MODE_REPLACE:
  196. .. rst-class:: classref-enumeration-constant
  197. :ref:`DampMode<enum_RigidBody3D_DampMode>` **DAMP_MODE_REPLACE** = ``1``
  198. In this mode, the body's damping value replaces any value set in areas or the default value.
  199. .. rst-class:: classref-section-separator
  200. ----
  201. .. rst-class:: classref-descriptions-group
  202. Property Descriptions
  203. ---------------------
  204. .. _class_RigidBody3D_property_angular_damp:
  205. .. rst-class:: classref-property
  206. :ref:`float<class_float>` **angular_damp** = ``0.0`` :ref:`๐Ÿ”—<class_RigidBody3D_property_angular_damp>`
  207. .. rst-class:: classref-property-setget
  208. - |void| **set_angular_damp**\ (\ value\: :ref:`float<class_float>`\ )
  209. - :ref:`float<class_float>` **get_angular_damp**\ (\ )
  210. Damps the body's rotation. By default, the body will use the :ref:`ProjectSettings.physics/3d/default_angular_damp<class_ProjectSettings_property_physics/3d/default_angular_damp>` project setting or any value override set by an :ref:`Area3D<class_Area3D>` the body is in. Depending on :ref:`angular_damp_mode<class_RigidBody3D_property_angular_damp_mode>`, you can set :ref:`angular_damp<class_RigidBody3D_property_angular_damp>` to be added to or to replace the body's damping value.
  211. See :ref:`ProjectSettings.physics/3d/default_angular_damp<class_ProjectSettings_property_physics/3d/default_angular_damp>` for more details about damping.
  212. .. rst-class:: classref-item-separator
  213. ----
  214. .. _class_RigidBody3D_property_angular_damp_mode:
  215. .. rst-class:: classref-property
  216. :ref:`DampMode<enum_RigidBody3D_DampMode>` **angular_damp_mode** = ``0`` :ref:`๐Ÿ”—<class_RigidBody3D_property_angular_damp_mode>`
  217. .. rst-class:: classref-property-setget
  218. - |void| **set_angular_damp_mode**\ (\ value\: :ref:`DampMode<enum_RigidBody3D_DampMode>`\ )
  219. - :ref:`DampMode<enum_RigidBody3D_DampMode>` **get_angular_damp_mode**\ (\ )
  220. Defines how :ref:`angular_damp<class_RigidBody3D_property_angular_damp>` is applied.
  221. .. rst-class:: classref-item-separator
  222. ----
  223. .. _class_RigidBody3D_property_angular_velocity:
  224. .. rst-class:: classref-property
  225. :ref:`Vector3<class_Vector3>` **angular_velocity** = ``Vector3(0, 0, 0)`` :ref:`๐Ÿ”—<class_RigidBody3D_property_angular_velocity>`
  226. .. rst-class:: classref-property-setget
  227. - |void| **set_angular_velocity**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
  228. - :ref:`Vector3<class_Vector3>` **get_angular_velocity**\ (\ )
  229. The RigidBody3D's rotational velocity in *radians* per second.
  230. .. rst-class:: classref-item-separator
  231. ----
  232. .. _class_RigidBody3D_property_can_sleep:
  233. .. rst-class:: classref-property
  234. :ref:`bool<class_bool>` **can_sleep** = ``true`` :ref:`๐Ÿ”—<class_RigidBody3D_property_can_sleep>`
  235. .. rst-class:: classref-property-setget
  236. - |void| **set_can_sleep**\ (\ value\: :ref:`bool<class_bool>`\ )
  237. - :ref:`bool<class_bool>` **is_able_to_sleep**\ (\ )
  238. If ``true``, the body can enter sleep mode when there is no movement. See :ref:`sleeping<class_RigidBody3D_property_sleeping>`.
  239. .. rst-class:: classref-item-separator
  240. ----
  241. .. _class_RigidBody3D_property_center_of_mass:
  242. .. rst-class:: classref-property
  243. :ref:`Vector3<class_Vector3>` **center_of_mass** = ``Vector3(0, 0, 0)`` :ref:`๐Ÿ”—<class_RigidBody3D_property_center_of_mass>`
  244. .. rst-class:: classref-property-setget
  245. - |void| **set_center_of_mass**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
  246. - :ref:`Vector3<class_Vector3>` **get_center_of_mass**\ (\ )
  247. The body's custom center of mass, relative to the body's origin position, when :ref:`center_of_mass_mode<class_RigidBody3D_property_center_of_mass_mode>` is set to :ref:`CENTER_OF_MASS_MODE_CUSTOM<class_RigidBody3D_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.
  248. When :ref:`center_of_mass_mode<class_RigidBody3D_property_center_of_mass_mode>` is set to :ref:`CENTER_OF_MASS_MODE_AUTO<class_RigidBody3D_constant_CENTER_OF_MASS_MODE_AUTO>` (default value), the center of mass is automatically computed.
  249. .. rst-class:: classref-item-separator
  250. ----
  251. .. _class_RigidBody3D_property_center_of_mass_mode:
  252. .. rst-class:: classref-property
  253. :ref:`CenterOfMassMode<enum_RigidBody3D_CenterOfMassMode>` **center_of_mass_mode** = ``0`` :ref:`๐Ÿ”—<class_RigidBody3D_property_center_of_mass_mode>`
  254. .. rst-class:: classref-property-setget
  255. - |void| **set_center_of_mass_mode**\ (\ value\: :ref:`CenterOfMassMode<enum_RigidBody3D_CenterOfMassMode>`\ )
  256. - :ref:`CenterOfMassMode<enum_RigidBody3D_CenterOfMassMode>` **get_center_of_mass_mode**\ (\ )
  257. Defines the way the body's center of mass is set.
  258. .. rst-class:: classref-item-separator
  259. ----
  260. .. _class_RigidBody3D_property_constant_force:
  261. .. rst-class:: classref-property
  262. :ref:`Vector3<class_Vector3>` **constant_force** = ``Vector3(0, 0, 0)`` :ref:`๐Ÿ”—<class_RigidBody3D_property_constant_force>`
  263. .. rst-class:: classref-property-setget
  264. - |void| **set_constant_force**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
  265. - :ref:`Vector3<class_Vector3>` **get_constant_force**\ (\ )
  266. The body's total constant positional forces applied during each physics update.
  267. See :ref:`add_constant_force()<class_RigidBody3D_method_add_constant_force>` and :ref:`add_constant_central_force()<class_RigidBody3D_method_add_constant_central_force>`.
  268. .. rst-class:: classref-item-separator
  269. ----
  270. .. _class_RigidBody3D_property_constant_torque:
  271. .. rst-class:: classref-property
  272. :ref:`Vector3<class_Vector3>` **constant_torque** = ``Vector3(0, 0, 0)`` :ref:`๐Ÿ”—<class_RigidBody3D_property_constant_torque>`
  273. .. rst-class:: classref-property-setget
  274. - |void| **set_constant_torque**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
  275. - :ref:`Vector3<class_Vector3>` **get_constant_torque**\ (\ )
  276. The body's total constant rotational forces applied during each physics update.
  277. See :ref:`add_constant_torque()<class_RigidBody3D_method_add_constant_torque>`.
  278. .. rst-class:: classref-item-separator
  279. ----
  280. .. _class_RigidBody3D_property_contact_monitor:
  281. .. rst-class:: classref-property
  282. :ref:`bool<class_bool>` **contact_monitor** = ``false`` :ref:`๐Ÿ”—<class_RigidBody3D_property_contact_monitor>`
  283. .. rst-class:: classref-property-setget
  284. - |void| **set_contact_monitor**\ (\ value\: :ref:`bool<class_bool>`\ )
  285. - :ref:`bool<class_bool>` **is_contact_monitor_enabled**\ (\ )
  286. If ``true``, the RigidBody3D will emit signals when it collides with another body.
  287. \ **Note:** By default the maximum contacts reported is set to 0, meaning nothing will be recorded, see :ref:`max_contacts_reported<class_RigidBody3D_property_max_contacts_reported>`.
  288. .. rst-class:: classref-item-separator
  289. ----
  290. .. _class_RigidBody3D_property_continuous_cd:
  291. .. rst-class:: classref-property
  292. :ref:`bool<class_bool>` **continuous_cd** = ``false`` :ref:`๐Ÿ”—<class_RigidBody3D_property_continuous_cd>`
  293. .. rst-class:: classref-property-setget
  294. - |void| **set_use_continuous_collision_detection**\ (\ value\: :ref:`bool<class_bool>`\ )
  295. - :ref:`bool<class_bool>` **is_using_continuous_collision_detection**\ (\ )
  296. If ``true``, continuous collision detection is used.
  297. 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.
  298. .. rst-class:: classref-item-separator
  299. ----
  300. .. _class_RigidBody3D_property_custom_integrator:
  301. .. rst-class:: classref-property
  302. :ref:`bool<class_bool>` **custom_integrator** = ``false`` :ref:`๐Ÿ”—<class_RigidBody3D_property_custom_integrator>`
  303. .. rst-class:: classref-property-setget
  304. - |void| **set_use_custom_integrator**\ (\ value\: :ref:`bool<class_bool>`\ )
  305. - :ref:`bool<class_bool>` **is_using_custom_integrator**\ (\ )
  306. If ``true``, 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 :ref:`_integrate_forces()<class_RigidBody3D_private_method__integrate_forces>` method, if that virtual method is overridden.
  307. Setting this property will call the method :ref:`PhysicsServer3D.body_set_omit_force_integration()<class_PhysicsServer3D_method_body_set_omit_force_integration>` internally.
  308. .. rst-class:: classref-item-separator
  309. ----
  310. .. _class_RigidBody3D_property_freeze:
  311. .. rst-class:: classref-property
  312. :ref:`bool<class_bool>` **freeze** = ``false`` :ref:`๐Ÿ”—<class_RigidBody3D_property_freeze>`
  313. .. rst-class:: classref-property-setget
  314. - |void| **set_freeze_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
  315. - :ref:`bool<class_bool>` **is_freeze_enabled**\ (\ )
  316. If ``true``, the body is frozen. Gravity and forces are not applied anymore.
  317. See :ref:`freeze_mode<class_RigidBody3D_property_freeze_mode>` to set the body's behavior when frozen.
  318. For a body that is always frozen, use :ref:`StaticBody3D<class_StaticBody3D>` or :ref:`AnimatableBody3D<class_AnimatableBody3D>` instead.
  319. .. rst-class:: classref-item-separator
  320. ----
  321. .. _class_RigidBody3D_property_freeze_mode:
  322. .. rst-class:: classref-property
  323. :ref:`FreezeMode<enum_RigidBody3D_FreezeMode>` **freeze_mode** = ``0`` :ref:`๐Ÿ”—<class_RigidBody3D_property_freeze_mode>`
  324. .. rst-class:: classref-property-setget
  325. - |void| **set_freeze_mode**\ (\ value\: :ref:`FreezeMode<enum_RigidBody3D_FreezeMode>`\ )
  326. - :ref:`FreezeMode<enum_RigidBody3D_FreezeMode>` **get_freeze_mode**\ (\ )
  327. The body's freeze mode. Can be used to set the body's behavior when :ref:`freeze<class_RigidBody3D_property_freeze>` is enabled.
  328. For a body that is always frozen, use :ref:`StaticBody3D<class_StaticBody3D>` or :ref:`AnimatableBody3D<class_AnimatableBody3D>` instead.
  329. .. rst-class:: classref-item-separator
  330. ----
  331. .. _class_RigidBody3D_property_gravity_scale:
  332. .. rst-class:: classref-property
  333. :ref:`float<class_float>` **gravity_scale** = ``1.0`` :ref:`๐Ÿ”—<class_RigidBody3D_property_gravity_scale>`
  334. .. rst-class:: classref-property-setget
  335. - |void| **set_gravity_scale**\ (\ value\: :ref:`float<class_float>`\ )
  336. - :ref:`float<class_float>` **get_gravity_scale**\ (\ )
  337. This is multiplied by :ref:`ProjectSettings.physics/3d/default_gravity<class_ProjectSettings_property_physics/3d/default_gravity>` to produce this body's gravity. For example, a value of ``1.0`` will apply normal gravity, ``2.0`` will apply double the gravity, and ``0.5`` will apply half the gravity to this body.
  338. .. rst-class:: classref-item-separator
  339. ----
  340. .. _class_RigidBody3D_property_inertia:
  341. .. rst-class:: classref-property
  342. :ref:`Vector3<class_Vector3>` **inertia** = ``Vector3(0, 0, 0)`` :ref:`๐Ÿ”—<class_RigidBody3D_property_inertia>`
  343. .. rst-class:: classref-property-setget
  344. - |void| **set_inertia**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
  345. - :ref:`Vector3<class_Vector3>` **get_inertia**\ (\ )
  346. 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.
  347. If set to :ref:`Vector3.ZERO<class_Vector3_constant_ZERO>`, inertia is automatically computed (default value).
  348. \ **Note:** This value does not change when inertia is automatically computed. Use :ref:`PhysicsServer3D<class_PhysicsServer3D>` to get the computed inertia.
  349. .. tabs::
  350. .. code-tab:: gdscript
  351. @onready var ball = $Ball
  352. func get_ball_inertia():
  353. return PhysicsServer3D.body_get_direct_state(ball.get_rid()).inverse_inertia.inverse()
  354. .. code-tab:: csharp
  355. private RigidBody3D _ball;
  356. public override void _Ready()
  357. {
  358. _ball = GetNode<RigidBody3D>("Ball");
  359. }
  360. private Vector3 GetBallInertia()
  361. {
  362. return PhysicsServer3D.BodyGetDirectState(_ball.GetRid()).InverseInertia.Inverse();
  363. }
  364. .. rst-class:: classref-item-separator
  365. ----
  366. .. _class_RigidBody3D_property_linear_damp:
  367. .. rst-class:: classref-property
  368. :ref:`float<class_float>` **linear_damp** = ``0.0`` :ref:`๐Ÿ”—<class_RigidBody3D_property_linear_damp>`
  369. .. rst-class:: classref-property-setget
  370. - |void| **set_linear_damp**\ (\ value\: :ref:`float<class_float>`\ )
  371. - :ref:`float<class_float>` **get_linear_damp**\ (\ )
  372. Damps the body's movement. By default, the body will use the :ref:`ProjectSettings.physics/3d/default_linear_damp<class_ProjectSettings_property_physics/3d/default_linear_damp>` project setting or any value override set by an :ref:`Area3D<class_Area3D>` the body is in. Depending on :ref:`linear_damp_mode<class_RigidBody3D_property_linear_damp_mode>`, you can set :ref:`linear_damp<class_RigidBody3D_property_linear_damp>` to be added to or to replace the body's damping value.
  373. See :ref:`ProjectSettings.physics/3d/default_linear_damp<class_ProjectSettings_property_physics/3d/default_linear_damp>` for more details about damping.
  374. .. rst-class:: classref-item-separator
  375. ----
  376. .. _class_RigidBody3D_property_linear_damp_mode:
  377. .. rst-class:: classref-property
  378. :ref:`DampMode<enum_RigidBody3D_DampMode>` **linear_damp_mode** = ``0`` :ref:`๐Ÿ”—<class_RigidBody3D_property_linear_damp_mode>`
  379. .. rst-class:: classref-property-setget
  380. - |void| **set_linear_damp_mode**\ (\ value\: :ref:`DampMode<enum_RigidBody3D_DampMode>`\ )
  381. - :ref:`DampMode<enum_RigidBody3D_DampMode>` **get_linear_damp_mode**\ (\ )
  382. Defines how :ref:`linear_damp<class_RigidBody3D_property_linear_damp>` is applied.
  383. .. rst-class:: classref-item-separator
  384. ----
  385. .. _class_RigidBody3D_property_linear_velocity:
  386. .. rst-class:: classref-property
  387. :ref:`Vector3<class_Vector3>` **linear_velocity** = ``Vector3(0, 0, 0)`` :ref:`๐Ÿ”—<class_RigidBody3D_property_linear_velocity>`
  388. .. rst-class:: classref-property-setget
  389. - |void| **set_linear_velocity**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
  390. - :ref:`Vector3<class_Vector3>` **get_linear_velocity**\ (\ )
  391. The body's linear velocity in units per second. Can be used sporadically, but **don't set this every frame**, because physics may run in another thread and runs at a different granularity. Use :ref:`_integrate_forces()<class_RigidBody3D_private_method__integrate_forces>` as your process loop for precise control of the body state.
  392. .. rst-class:: classref-item-separator
  393. ----
  394. .. _class_RigidBody3D_property_lock_rotation:
  395. .. rst-class:: classref-property
  396. :ref:`bool<class_bool>` **lock_rotation** = ``false`` :ref:`๐Ÿ”—<class_RigidBody3D_property_lock_rotation>`
  397. .. rst-class:: classref-property-setget
  398. - |void| **set_lock_rotation_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
  399. - :ref:`bool<class_bool>` **is_lock_rotation_enabled**\ (\ )
  400. If ``true``, the body cannot rotate. Gravity and forces only apply linear movement.
  401. .. rst-class:: classref-item-separator
  402. ----
  403. .. _class_RigidBody3D_property_mass:
  404. .. rst-class:: classref-property
  405. :ref:`float<class_float>` **mass** = ``1.0`` :ref:`๐Ÿ”—<class_RigidBody3D_property_mass>`
  406. .. rst-class:: classref-property-setget
  407. - |void| **set_mass**\ (\ value\: :ref:`float<class_float>`\ )
  408. - :ref:`float<class_float>` **get_mass**\ (\ )
  409. The body's mass.
  410. .. rst-class:: classref-item-separator
  411. ----
  412. .. _class_RigidBody3D_property_max_contacts_reported:
  413. .. rst-class:: classref-property
  414. :ref:`int<class_int>` **max_contacts_reported** = ``0`` :ref:`๐Ÿ”—<class_RigidBody3D_property_max_contacts_reported>`
  415. .. rst-class:: classref-property-setget
  416. - |void| **set_max_contacts_reported**\ (\ value\: :ref:`int<class_int>`\ )
  417. - :ref:`int<class_int>` **get_max_contacts_reported**\ (\ )
  418. The maximum number of contacts that will be recorded. Requires a value greater than 0 and :ref:`contact_monitor<class_RigidBody3D_property_contact_monitor>` to be set to ``true`` to start to register contacts. Use :ref:`get_contact_count()<class_RigidBody3D_method_get_contact_count>` to retrieve the count or :ref:`get_colliding_bodies()<class_RigidBody3D_method_get_colliding_bodies>` to retrieve bodies that have been collided with.
  419. \ **Note:** The number of contacts is different from the number of collisions. Collisions between parallel edges will result in two contacts (one at each end), and collisions between parallel faces will result in four contacts (one at each corner).
  420. .. rst-class:: classref-item-separator
  421. ----
  422. .. _class_RigidBody3D_property_physics_material_override:
  423. .. rst-class:: classref-property
  424. :ref:`PhysicsMaterial<class_PhysicsMaterial>` **physics_material_override** :ref:`๐Ÿ”—<class_RigidBody3D_property_physics_material_override>`
  425. .. rst-class:: classref-property-setget
  426. - |void| **set_physics_material_override**\ (\ value\: :ref:`PhysicsMaterial<class_PhysicsMaterial>`\ )
  427. - :ref:`PhysicsMaterial<class_PhysicsMaterial>` **get_physics_material_override**\ (\ )
  428. The physics material override for the body.
  429. If a material is assigned to this property, it will be used instead of any other physics material, such as an inherited one.
  430. .. rst-class:: classref-item-separator
  431. ----
  432. .. _class_RigidBody3D_property_sleeping:
  433. .. rst-class:: classref-property
  434. :ref:`bool<class_bool>` **sleeping** = ``false`` :ref:`๐Ÿ”—<class_RigidBody3D_property_sleeping>`
  435. .. rst-class:: classref-property-setget
  436. - |void| **set_sleeping**\ (\ value\: :ref:`bool<class_bool>`\ )
  437. - :ref:`bool<class_bool>` **is_sleeping**\ (\ )
  438. If ``true``, the body will not move and will not calculate forces until woken up by another body through, for example, a collision, or by using the :ref:`apply_impulse()<class_RigidBody3D_method_apply_impulse>` or :ref:`apply_force()<class_RigidBody3D_method_apply_force>` methods.
  439. .. rst-class:: classref-section-separator
  440. ----
  441. .. rst-class:: classref-descriptions-group
  442. Method Descriptions
  443. -------------------
  444. .. _class_RigidBody3D_private_method__integrate_forces:
  445. .. rst-class:: classref-method
  446. |void| **_integrate_forces**\ (\ state\: :ref:`PhysicsDirectBodyState3D<class_PhysicsDirectBodyState3D>`\ ) |virtual| :ref:`๐Ÿ”—<class_RigidBody3D_private_method__integrate_forces>`
  447. 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 :ref:`custom_integrator<class_RigidBody3D_property_custom_integrator>` property allows you to disable the standard force integration and do fully custom force integration for a body.
  448. .. rst-class:: classref-item-separator
  449. ----
  450. .. _class_RigidBody3D_method_add_constant_central_force:
  451. .. rst-class:: classref-method
  452. |void| **add_constant_central_force**\ (\ force\: :ref:`Vector3<class_Vector3>`\ ) :ref:`๐Ÿ”—<class_RigidBody3D_method_add_constant_central_force>`
  453. Adds a constant directional force without affecting rotation that keeps being applied over time until cleared with ``constant_force = Vector3(0, 0, 0)``.
  454. This is equivalent to using :ref:`add_constant_force()<class_RigidBody3D_method_add_constant_force>` at the body's center of mass.
  455. .. rst-class:: classref-item-separator
  456. ----
  457. .. _class_RigidBody3D_method_add_constant_force:
  458. .. rst-class:: classref-method
  459. |void| **add_constant_force**\ (\ force\: :ref:`Vector3<class_Vector3>`, position\: :ref:`Vector3<class_Vector3>` = Vector3(0, 0, 0)\ ) :ref:`๐Ÿ”—<class_RigidBody3D_method_add_constant_force>`
  460. Adds a constant positioned force to the body that keeps being applied over time until cleared with ``constant_force = Vector3(0, 0, 0)``.
  461. \ ``position`` is the offset from the body origin in global coordinates.
  462. .. rst-class:: classref-item-separator
  463. ----
  464. .. _class_RigidBody3D_method_add_constant_torque:
  465. .. rst-class:: classref-method
  466. |void| **add_constant_torque**\ (\ torque\: :ref:`Vector3<class_Vector3>`\ ) :ref:`๐Ÿ”—<class_RigidBody3D_method_add_constant_torque>`
  467. Adds a constant rotational force without affecting position that keeps being applied over time until cleared with ``constant_torque = Vector3(0, 0, 0)``.
  468. .. rst-class:: classref-item-separator
  469. ----
  470. .. _class_RigidBody3D_method_apply_central_force:
  471. .. rst-class:: classref-method
  472. |void| **apply_central_force**\ (\ force\: :ref:`Vector3<class_Vector3>`\ ) :ref:`๐Ÿ”—<class_RigidBody3D_method_apply_central_force>`
  473. Applies a directional force without affecting rotation. A force is time dependent and meant to be applied every physics update.
  474. This is equivalent to using :ref:`apply_force()<class_RigidBody3D_method_apply_force>` at the body's center of mass.
  475. .. rst-class:: classref-item-separator
  476. ----
  477. .. _class_RigidBody3D_method_apply_central_impulse:
  478. .. rst-class:: classref-method
  479. |void| **apply_central_impulse**\ (\ impulse\: :ref:`Vector3<class_Vector3>`\ ) :ref:`๐Ÿ”—<class_RigidBody3D_method_apply_central_impulse>`
  480. Applies a directional impulse without affecting rotation.
  481. An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise).
  482. This is equivalent to using :ref:`apply_impulse()<class_RigidBody3D_method_apply_impulse>` at the body's center of mass.
  483. .. rst-class:: classref-item-separator
  484. ----
  485. .. _class_RigidBody3D_method_apply_force:
  486. .. rst-class:: classref-method
  487. |void| **apply_force**\ (\ force\: :ref:`Vector3<class_Vector3>`, position\: :ref:`Vector3<class_Vector3>` = Vector3(0, 0, 0)\ ) :ref:`๐Ÿ”—<class_RigidBody3D_method_apply_force>`
  488. Applies a positioned force to the body. A force is time dependent and meant to be applied every physics update.
  489. \ ``position`` is the offset from the body origin in global coordinates.
  490. .. rst-class:: classref-item-separator
  491. ----
  492. .. _class_RigidBody3D_method_apply_impulse:
  493. .. rst-class:: classref-method
  494. |void| **apply_impulse**\ (\ impulse\: :ref:`Vector3<class_Vector3>`, position\: :ref:`Vector3<class_Vector3>` = Vector3(0, 0, 0)\ ) :ref:`๐Ÿ”—<class_RigidBody3D_method_apply_impulse>`
  495. Applies a positioned impulse to the body.
  496. An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise).
  497. \ ``position`` is the offset from the body origin in global coordinates.
  498. .. rst-class:: classref-item-separator
  499. ----
  500. .. _class_RigidBody3D_method_apply_torque:
  501. .. rst-class:: classref-method
  502. |void| **apply_torque**\ (\ torque\: :ref:`Vector3<class_Vector3>`\ ) :ref:`๐Ÿ”—<class_RigidBody3D_method_apply_torque>`
  503. Applies a rotational force without affecting position. A force is time dependent and meant to be applied every physics update.
  504. \ **Note:** :ref:`inertia<class_RigidBody3D_property_inertia>` is required for this to work. To have :ref:`inertia<class_RigidBody3D_property_inertia>`, an active :ref:`CollisionShape3D<class_CollisionShape3D>` must be a child of the node, or you can manually set :ref:`inertia<class_RigidBody3D_property_inertia>`.
  505. .. rst-class:: classref-item-separator
  506. ----
  507. .. _class_RigidBody3D_method_apply_torque_impulse:
  508. .. rst-class:: classref-method
  509. |void| **apply_torque_impulse**\ (\ impulse\: :ref:`Vector3<class_Vector3>`\ ) :ref:`๐Ÿ”—<class_RigidBody3D_method_apply_torque_impulse>`
  510. Applies a rotational impulse to the body without affecting the position.
  511. An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise).
  512. \ **Note:** :ref:`inertia<class_RigidBody3D_property_inertia>` is required for this to work. To have :ref:`inertia<class_RigidBody3D_property_inertia>`, an active :ref:`CollisionShape3D<class_CollisionShape3D>` must be a child of the node, or you can manually set :ref:`inertia<class_RigidBody3D_property_inertia>`.
  513. .. rst-class:: classref-item-separator
  514. ----
  515. .. _class_RigidBody3D_method_get_colliding_bodies:
  516. .. rst-class:: classref-method
  517. :ref:`Array<class_Array>`\[:ref:`Node3D<class_Node3D>`\] **get_colliding_bodies**\ (\ ) |const| :ref:`๐Ÿ”—<class_RigidBody3D_method_get_colliding_bodies>`
  518. Returns a list of the bodies colliding with this one. Requires :ref:`contact_monitor<class_RigidBody3D_property_contact_monitor>` to be set to ``true`` and :ref:`max_contacts_reported<class_RigidBody3D_property_max_contacts_reported>` to be set high enough to detect all the collisions.
  519. \ **Note:** The result of this test is not immediate after moving objects. For performance, list of collisions is updated once per frame and before the physics step. Consider using signals instead.
  520. .. rst-class:: classref-item-separator
  521. ----
  522. .. _class_RigidBody3D_method_get_contact_count:
  523. .. rst-class:: classref-method
  524. :ref:`int<class_int>` **get_contact_count**\ (\ ) |const| :ref:`๐Ÿ”—<class_RigidBody3D_method_get_contact_count>`
  525. Returns the number of contacts this body has with other bodies. By default, this returns 0 unless bodies are configured to monitor contacts (see :ref:`contact_monitor<class_RigidBody3D_property_contact_monitor>`).
  526. \ **Note:** To retrieve the colliding bodies, use :ref:`get_colliding_bodies()<class_RigidBody3D_method_get_colliding_bodies>`.
  527. .. rst-class:: classref-item-separator
  528. ----
  529. .. _class_RigidBody3D_method_get_inverse_inertia_tensor:
  530. .. rst-class:: classref-method
  531. :ref:`Basis<class_Basis>` **get_inverse_inertia_tensor**\ (\ ) |const| :ref:`๐Ÿ”—<class_RigidBody3D_method_get_inverse_inertia_tensor>`
  532. Returns the inverse inertia tensor basis. This is used to calculate the angular acceleration resulting from a torque applied to the **RigidBody3D**.
  533. .. rst-class:: classref-item-separator
  534. ----
  535. .. _class_RigidBody3D_method_set_axis_velocity:
  536. .. rst-class:: classref-method
  537. |void| **set_axis_velocity**\ (\ axis_velocity\: :ref:`Vector3<class_Vector3>`\ ) :ref:`๐Ÿ”—<class_RigidBody3D_method_set_axis_velocity>`
  538. Sets an axis velocity. The velocity in the given vector axis will be set as the given vector length. This is useful for jumping behavior.
  539. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  540. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  541. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  542. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  543. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  544. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  545. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  546. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  547. .. |void| replace:: :abbr:`void (No return value.)`