class_rigidbody.rst 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_RigidBody:
  4. RigidBody
  5. =========
  6. **Inherits:** :ref:`PhysicsBody<class_physicsbody>` **<** :ref:`CollisionObject<class_collisionobject>` **<** :ref:`Spatial<class_spatial>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  7. **Category:** Core
  8. Brief Description
  9. -----------------
  10. Member Functions
  11. ----------------
  12. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  13. | void | :ref:`_integrate_forces<class_RigidBody__integrate_forces>` **(** :ref:`PhysicsDirectBodyState<class_physicsdirectbodystate>` state **)** virtual |
  14. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | void | :ref:`set_mode<class_RigidBody_set_mode>` **(** :ref:`int<class_int>` mode **)** |
  16. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`int<class_int>` | :ref:`get_mode<class_RigidBody_get_mode>` **(** **)** const |
  18. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | void | :ref:`set_mass<class_RigidBody_set_mass>` **(** :ref:`float<class_float>` mass **)** |
  20. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`float<class_float>` | :ref:`get_mass<class_RigidBody_get_mass>` **(** **)** const |
  22. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | void | :ref:`set_weight<class_RigidBody_set_weight>` **(** :ref:`float<class_float>` weight **)** |
  24. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`float<class_float>` | :ref:`get_weight<class_RigidBody_get_weight>` **(** **)** const |
  26. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`set_friction<class_RigidBody_set_friction>` **(** :ref:`float<class_float>` friction **)** |
  28. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`float<class_float>` | :ref:`get_friction<class_RigidBody_get_friction>` **(** **)** const |
  30. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | void | :ref:`set_bounce<class_RigidBody_set_bounce>` **(** :ref:`float<class_float>` bounce **)** |
  32. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`float<class_float>` | :ref:`get_bounce<class_RigidBody_get_bounce>` **(** **)** const |
  34. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`set_linear_velocity<class_RigidBody_set_linear_velocity>` **(** :ref:`Vector3<class_vector3>` linear_velocity **)** |
  36. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`Vector3<class_vector3>` | :ref:`get_linear_velocity<class_RigidBody_get_linear_velocity>` **(** **)** const |
  38. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | void | :ref:`set_angular_velocity<class_RigidBody_set_angular_velocity>` **(** :ref:`Vector3<class_vector3>` angular_velocity **)** |
  40. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`Vector3<class_vector3>` | :ref:`get_angular_velocity<class_RigidBody_get_angular_velocity>` **(** **)** const |
  42. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | void | :ref:`set_gravity_scale<class_RigidBody_set_gravity_scale>` **(** :ref:`float<class_float>` gravity_scale **)** |
  44. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`float<class_float>` | :ref:`get_gravity_scale<class_RigidBody_get_gravity_scale>` **(** **)** const |
  46. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | void | :ref:`set_linear_damp<class_RigidBody_set_linear_damp>` **(** :ref:`float<class_float>` linear_damp **)** |
  48. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`float<class_float>` | :ref:`get_linear_damp<class_RigidBody_get_linear_damp>` **(** **)** const |
  50. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | void | :ref:`set_angular_damp<class_RigidBody_set_angular_damp>` **(** :ref:`float<class_float>` angular_damp **)** |
  52. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`float<class_float>` | :ref:`get_angular_damp<class_RigidBody_get_angular_damp>` **(** **)** const |
  54. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | void | :ref:`set_max_contacts_reported<class_RigidBody_set_max_contacts_reported>` **(** :ref:`int<class_int>` amount **)** |
  56. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`int<class_int>` | :ref:`get_max_contacts_reported<class_RigidBody_get_max_contacts_reported>` **(** **)** const |
  58. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | void | :ref:`set_use_custom_integrator<class_RigidBody_set_use_custom_integrator>` **(** :ref:`bool<class_bool>` enable **)** |
  60. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`bool<class_bool>` | :ref:`is_using_custom_integrator<class_RigidBody_is_using_custom_integrator>` **(** **)** |
  62. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | void | :ref:`set_contact_monitor<class_RigidBody_set_contact_monitor>` **(** :ref:`bool<class_bool>` enabled **)** |
  64. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | :ref:`bool<class_bool>` | :ref:`is_contact_monitor_enabled<class_RigidBody_is_contact_monitor_enabled>` **(** **)** const |
  66. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | void | :ref:`set_use_continuous_collision_detection<class_RigidBody_set_use_continuous_collision_detection>` **(** :ref:`bool<class_bool>` enable **)** |
  68. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | :ref:`bool<class_bool>` | :ref:`is_using_continuous_collision_detection<class_RigidBody_is_using_continuous_collision_detection>` **(** **)** const |
  70. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | void | :ref:`set_axis_velocity<class_RigidBody_set_axis_velocity>` **(** :ref:`Vector3<class_vector3>` axis_velocity **)** |
  72. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | void | :ref:`apply_impulse<class_RigidBody_apply_impulse>` **(** :ref:`Vector3<class_vector3>` pos, :ref:`Vector3<class_vector3>` impulse **)** |
  74. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | void | :ref:`set_sleeping<class_RigidBody_set_sleeping>` **(** :ref:`bool<class_bool>` sleeping **)** |
  76. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | :ref:`bool<class_bool>` | :ref:`is_sleeping<class_RigidBody_is_sleeping>` **(** **)** const |
  78. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | void | :ref:`set_can_sleep<class_RigidBody_set_can_sleep>` **(** :ref:`bool<class_bool>` able_to_sleep **)** |
  80. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | :ref:`bool<class_bool>` | :ref:`is_able_to_sleep<class_RigidBody_is_able_to_sleep>` **(** **)** const |
  82. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | void | :ref:`set_axis_lock<class_RigidBody_set_axis_lock>` **(** :ref:`int<class_int>` axis_lock **)** |
  84. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | :ref:`int<class_int>` | :ref:`get_axis_lock<class_RigidBody_get_axis_lock>` **(** **)** const |
  86. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | :ref:`Array<class_array>` | :ref:`get_colliding_bodies<class_RigidBody_get_colliding_bodies>` **(** **)** const |
  88. +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  89. Signals
  90. -------
  91. - **body_enter** **(** :ref:`Object<class_object>` body **)**
  92. - **body_enter_shape** **(** :ref:`int<class_int>` body_id, :ref:`Object<class_object>` body, :ref:`int<class_int>` body_shape, :ref:`int<class_int>` local_shape **)**
  93. - **body_exit** **(** :ref:`Object<class_object>` body **)**
  94. - **body_exit_shape** **(** :ref:`int<class_int>` body_id, :ref:`Object<class_object>` body, :ref:`int<class_int>` body_shape, :ref:`int<class_int>` local_shape **)**
  95. - **sleeping_state_changed** **(** **)**
  96. Numeric Constants
  97. -----------------
  98. - **MODE_STATIC** = **1**
  99. - **MODE_KINEMATIC** = **3**
  100. - **MODE_RIGID** = **0**
  101. - **MODE_CHARACTER** = **2**
  102. Member Function Description
  103. ---------------------------
  104. .. _class_RigidBody__integrate_forces:
  105. - void **_integrate_forces** **(** :ref:`PhysicsDirectBodyState<class_physicsdirectbodystate>` state **)** virtual
  106. .. _class_RigidBody_set_mode:
  107. - void **set_mode** **(** :ref:`int<class_int>` mode **)**
  108. .. _class_RigidBody_get_mode:
  109. - :ref:`int<class_int>` **get_mode** **(** **)** const
  110. .. _class_RigidBody_set_mass:
  111. - void **set_mass** **(** :ref:`float<class_float>` mass **)**
  112. .. _class_RigidBody_get_mass:
  113. - :ref:`float<class_float>` **get_mass** **(** **)** const
  114. .. _class_RigidBody_set_weight:
  115. - void **set_weight** **(** :ref:`float<class_float>` weight **)**
  116. .. _class_RigidBody_get_weight:
  117. - :ref:`float<class_float>` **get_weight** **(** **)** const
  118. .. _class_RigidBody_set_friction:
  119. - void **set_friction** **(** :ref:`float<class_float>` friction **)**
  120. .. _class_RigidBody_get_friction:
  121. - :ref:`float<class_float>` **get_friction** **(** **)** const
  122. .. _class_RigidBody_set_bounce:
  123. - void **set_bounce** **(** :ref:`float<class_float>` bounce **)**
  124. .. _class_RigidBody_get_bounce:
  125. - :ref:`float<class_float>` **get_bounce** **(** **)** const
  126. .. _class_RigidBody_set_linear_velocity:
  127. - void **set_linear_velocity** **(** :ref:`Vector3<class_vector3>` linear_velocity **)**
  128. .. _class_RigidBody_get_linear_velocity:
  129. - :ref:`Vector3<class_vector3>` **get_linear_velocity** **(** **)** const
  130. .. _class_RigidBody_set_angular_velocity:
  131. - void **set_angular_velocity** **(** :ref:`Vector3<class_vector3>` angular_velocity **)**
  132. .. _class_RigidBody_get_angular_velocity:
  133. - :ref:`Vector3<class_vector3>` **get_angular_velocity** **(** **)** const
  134. .. _class_RigidBody_set_gravity_scale:
  135. - void **set_gravity_scale** **(** :ref:`float<class_float>` gravity_scale **)**
  136. .. _class_RigidBody_get_gravity_scale:
  137. - :ref:`float<class_float>` **get_gravity_scale** **(** **)** const
  138. .. _class_RigidBody_set_linear_damp:
  139. - void **set_linear_damp** **(** :ref:`float<class_float>` linear_damp **)**
  140. .. _class_RigidBody_get_linear_damp:
  141. - :ref:`float<class_float>` **get_linear_damp** **(** **)** const
  142. .. _class_RigidBody_set_angular_damp:
  143. - void **set_angular_damp** **(** :ref:`float<class_float>` angular_damp **)**
  144. .. _class_RigidBody_get_angular_damp:
  145. - :ref:`float<class_float>` **get_angular_damp** **(** **)** const
  146. .. _class_RigidBody_set_max_contacts_reported:
  147. - void **set_max_contacts_reported** **(** :ref:`int<class_int>` amount **)**
  148. .. _class_RigidBody_get_max_contacts_reported:
  149. - :ref:`int<class_int>` **get_max_contacts_reported** **(** **)** const
  150. .. _class_RigidBody_set_use_custom_integrator:
  151. - void **set_use_custom_integrator** **(** :ref:`bool<class_bool>` enable **)**
  152. .. _class_RigidBody_is_using_custom_integrator:
  153. - :ref:`bool<class_bool>` **is_using_custom_integrator** **(** **)**
  154. .. _class_RigidBody_set_contact_monitor:
  155. - void **set_contact_monitor** **(** :ref:`bool<class_bool>` enabled **)**
  156. .. _class_RigidBody_is_contact_monitor_enabled:
  157. - :ref:`bool<class_bool>` **is_contact_monitor_enabled** **(** **)** const
  158. .. _class_RigidBody_set_use_continuous_collision_detection:
  159. - void **set_use_continuous_collision_detection** **(** :ref:`bool<class_bool>` enable **)**
  160. .. _class_RigidBody_is_using_continuous_collision_detection:
  161. - :ref:`bool<class_bool>` **is_using_continuous_collision_detection** **(** **)** const
  162. .. _class_RigidBody_set_axis_velocity:
  163. - void **set_axis_velocity** **(** :ref:`Vector3<class_vector3>` axis_velocity **)**
  164. .. _class_RigidBody_apply_impulse:
  165. - void **apply_impulse** **(** :ref:`Vector3<class_vector3>` pos, :ref:`Vector3<class_vector3>` impulse **)**
  166. .. _class_RigidBody_set_sleeping:
  167. - void **set_sleeping** **(** :ref:`bool<class_bool>` sleeping **)**
  168. .. _class_RigidBody_is_sleeping:
  169. - :ref:`bool<class_bool>` **is_sleeping** **(** **)** const
  170. .. _class_RigidBody_set_can_sleep:
  171. - void **set_can_sleep** **(** :ref:`bool<class_bool>` able_to_sleep **)**
  172. .. _class_RigidBody_is_able_to_sleep:
  173. - :ref:`bool<class_bool>` **is_able_to_sleep** **(** **)** const
  174. .. _class_RigidBody_set_axis_lock:
  175. - void **set_axis_lock** **(** :ref:`int<class_int>` axis_lock **)**
  176. .. _class_RigidBody_get_axis_lock:
  177. - :ref:`int<class_int>` **get_axis_lock** **(** **)** const
  178. .. _class_RigidBody_get_colliding_bodies:
  179. - :ref:`Array<class_array>` **get_colliding_bodies** **(** **)** const