PhysicsDirectBodyState.xml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="PhysicsDirectBodyState" inherits="Object" category="Core" version="3.1.2">
  3. <brief_description>
  4. Direct access object to a physics body in the [PhysicsServer].
  5. </brief_description>
  6. <description>
  7. Provides direct access to a physics body in the [PhysicsServer], allowing safe changes to physics properties. This object is passed via the direct state callback of rigid/character bodies, and is intended for changing the direct state of that body. See [method RigidBody._integrate_forces].
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="add_central_force">
  13. <return type="void">
  14. </return>
  15. <argument index="0" name="force" type="Vector3">
  16. </argument>
  17. <description>
  18. Adds a constant directional force without affecting rotation.
  19. This is equivalent to [code]add_force(force, Vector3(0,0,0))[/code].
  20. </description>
  21. </method>
  22. <method name="add_force">
  23. <return type="void">
  24. </return>
  25. <argument index="0" name="force" type="Vector3">
  26. </argument>
  27. <argument index="1" name="position" type="Vector3">
  28. </argument>
  29. <description>
  30. Adds a positioned force to the body. Both the force and the offset from the body origin are in global coordinates.
  31. </description>
  32. </method>
  33. <method name="add_torque">
  34. <return type="void">
  35. </return>
  36. <argument index="0" name="torque" type="Vector3">
  37. </argument>
  38. <description>
  39. Adds a constant rotational force without affecting position.
  40. </description>
  41. </method>
  42. <method name="apply_central_impulse">
  43. <return type="void">
  44. </return>
  45. <argument index="0" name="j" type="Vector3">
  46. </argument>
  47. <description>
  48. Applies a single directional impulse without affecting rotation.
  49. This is equivalent to [code]apply_impulse(Vector3(0, 0, 0), impulse)[/code].
  50. </description>
  51. </method>
  52. <method name="apply_impulse">
  53. <return type="void">
  54. </return>
  55. <argument index="0" name="position" type="Vector3">
  56. </argument>
  57. <argument index="1" name="j" type="Vector3">
  58. </argument>
  59. <description>
  60. Applies a positioned impulse to the body. 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. The position uses the rotation of the global coordinate system, but is centered at the object's origin.
  61. </description>
  62. </method>
  63. <method name="apply_torque_impulse">
  64. <return type="void">
  65. </return>
  66. <argument index="0" name="j" type="Vector3">
  67. </argument>
  68. <description>
  69. Apply a torque impulse (which will be affected by the body mass and shape). This will rotate the body around the passed in vector.
  70. </description>
  71. </method>
  72. <method name="get_contact_collider" qualifiers="const">
  73. <return type="RID">
  74. </return>
  75. <argument index="0" name="contact_idx" type="int">
  76. </argument>
  77. <description>
  78. Returns the collider's [RID].
  79. </description>
  80. </method>
  81. <method name="get_contact_collider_id" qualifiers="const">
  82. <return type="int">
  83. </return>
  84. <argument index="0" name="contact_idx" type="int">
  85. </argument>
  86. <description>
  87. Returns the collider's object id.
  88. </description>
  89. </method>
  90. <method name="get_contact_collider_object" qualifiers="const">
  91. <return type="Object">
  92. </return>
  93. <argument index="0" name="contact_idx" type="int">
  94. </argument>
  95. <description>
  96. Returns the collider object.
  97. </description>
  98. </method>
  99. <method name="get_contact_collider_position" qualifiers="const">
  100. <return type="Vector3">
  101. </return>
  102. <argument index="0" name="contact_idx" type="int">
  103. </argument>
  104. <description>
  105. Returns the contact position in the collider.
  106. </description>
  107. </method>
  108. <method name="get_contact_collider_shape" qualifiers="const">
  109. <return type="int">
  110. </return>
  111. <argument index="0" name="contact_idx" type="int">
  112. </argument>
  113. <description>
  114. Returns the collider's shape index.
  115. </description>
  116. </method>
  117. <method name="get_contact_collider_velocity_at_position" qualifiers="const">
  118. <return type="Vector3">
  119. </return>
  120. <argument index="0" name="contact_idx" type="int">
  121. </argument>
  122. <description>
  123. Returns the linear velocity vector at the collider's contact point.
  124. </description>
  125. </method>
  126. <method name="get_contact_count" qualifiers="const">
  127. <return type="int">
  128. </return>
  129. <description>
  130. Returns the number of contacts this body has with other bodies. Note that by default this returns 0 unless bodies are configured to log contacts. See [member RigidBody.contact_monitor].
  131. </description>
  132. </method>
  133. <method name="get_contact_impulse" qualifiers="const">
  134. <return type="float">
  135. </return>
  136. <argument index="0" name="contact_idx" type="int">
  137. </argument>
  138. <description>
  139. Impulse created by the contact. Only implemented for Bullet physics.
  140. </description>
  141. </method>
  142. <method name="get_contact_local_normal" qualifiers="const">
  143. <return type="Vector3">
  144. </return>
  145. <argument index="0" name="contact_idx" type="int">
  146. </argument>
  147. <description>
  148. Returns the local normal at the contact point.
  149. </description>
  150. </method>
  151. <method name="get_contact_local_position" qualifiers="const">
  152. <return type="Vector3">
  153. </return>
  154. <argument index="0" name="contact_idx" type="int">
  155. </argument>
  156. <description>
  157. Returns the local position of the contact point.
  158. </description>
  159. </method>
  160. <method name="get_contact_local_shape" qualifiers="const">
  161. <return type="int">
  162. </return>
  163. <argument index="0" name="contact_idx" type="int">
  164. </argument>
  165. <description>
  166. Returns the local shape index of the collision.
  167. </description>
  168. </method>
  169. <method name="get_space_state">
  170. <return type="PhysicsDirectSpaceState">
  171. </return>
  172. <description>
  173. Returns the current state of the space, useful for queries.
  174. </description>
  175. </method>
  176. <method name="integrate_forces">
  177. <return type="void">
  178. </return>
  179. <description>
  180. Calls the built-in force integration code.
  181. </description>
  182. </method>
  183. </methods>
  184. <members>
  185. <member name="angular_velocity" type="Vector3" setter="set_angular_velocity" getter="get_angular_velocity">
  186. The body's rotational velocity.
  187. </member>
  188. <member name="center_of_mass" type="Vector3" setter="" getter="get_center_of_mass">
  189. </member>
  190. <member name="inverse_inertia" type="Vector3" setter="" getter="get_inverse_inertia">
  191. The inverse of the inertia of the body.
  192. </member>
  193. <member name="inverse_mass" type="float" setter="" getter="get_inverse_mass">
  194. The inverse of the mass of the body.
  195. </member>
  196. <member name="linear_velocity" type="Vector3" setter="set_linear_velocity" getter="get_linear_velocity">
  197. The body's linear velocity.
  198. </member>
  199. <member name="principal_inertia_axes" type="Basis" setter="" getter="get_principal_inertia_axes">
  200. </member>
  201. <member name="sleeping" type="bool" setter="set_sleep_state" getter="is_sleeping">
  202. If [code]true[/code], this body is currently sleeping (not active).
  203. </member>
  204. <member name="step" type="float" setter="" getter="get_step">
  205. The timestep (delta) used for the simulation.
  206. </member>
  207. <member name="total_angular_damp" type="float" setter="" getter="get_total_angular_damp">
  208. The rate at which the body stops rotating, if there are not any other forces moving it.
  209. </member>
  210. <member name="total_gravity" type="Vector3" setter="" getter="get_total_gravity">
  211. The total gravity vector being currently applied to this body.
  212. </member>
  213. <member name="total_linear_damp" type="float" setter="" getter="get_total_linear_damp">
  214. The rate at which the body stops moving, if there are not any other forces moving it.
  215. </member>
  216. <member name="transform" type="Transform" setter="set_transform" getter="get_transform">
  217. The body's transformation matrix.
  218. </member>
  219. </members>
  220. <constants>
  221. </constants>
  222. </class>