PhysicsDirectBodyState.xml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="PhysicsDirectBodyState" inherits="Object" version="3.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 vector [code]j[/code] passed as parameter.
  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.
  131. [b]Note:[/b] By default, this returns 0 unless bodies are configured to monitor contacts. See [member RigidBody.contact_monitor].
  132. </description>
  133. </method>
  134. <method name="get_contact_impulse" qualifiers="const">
  135. <return type="float">
  136. </return>
  137. <argument index="0" name="contact_idx" type="int">
  138. </argument>
  139. <description>
  140. Impulse created by the contact. Only implemented for Bullet physics.
  141. </description>
  142. </method>
  143. <method name="get_contact_local_normal" qualifiers="const">
  144. <return type="Vector3">
  145. </return>
  146. <argument index="0" name="contact_idx" type="int">
  147. </argument>
  148. <description>
  149. Returns the local normal at the contact point.
  150. </description>
  151. </method>
  152. <method name="get_contact_local_position" qualifiers="const">
  153. <return type="Vector3">
  154. </return>
  155. <argument index="0" name="contact_idx" type="int">
  156. </argument>
  157. <description>
  158. Returns the local position of the contact point.
  159. </description>
  160. </method>
  161. <method name="get_contact_local_shape" qualifiers="const">
  162. <return type="int">
  163. </return>
  164. <argument index="0" name="contact_idx" type="int">
  165. </argument>
  166. <description>
  167. Returns the local shape index of the collision.
  168. </description>
  169. </method>
  170. <method name="get_space_state">
  171. <return type="PhysicsDirectSpaceState">
  172. </return>
  173. <description>
  174. Returns the current state of the space, useful for queries.
  175. </description>
  176. </method>
  177. <method name="integrate_forces">
  178. <return type="void">
  179. </return>
  180. <description>
  181. Calls the built-in force integration code.
  182. </description>
  183. </method>
  184. </methods>
  185. <members>
  186. <member name="angular_velocity" type="Vector3" setter="set_angular_velocity" getter="get_angular_velocity">
  187. The body's rotational velocity.
  188. </member>
  189. <member name="center_of_mass" type="Vector3" setter="" getter="get_center_of_mass">
  190. </member>
  191. <member name="inverse_inertia" type="Vector3" setter="" getter="get_inverse_inertia">
  192. The inverse of the inertia of the body.
  193. </member>
  194. <member name="inverse_mass" type="float" setter="" getter="get_inverse_mass">
  195. The inverse of the mass of the body.
  196. </member>
  197. <member name="linear_velocity" type="Vector3" setter="set_linear_velocity" getter="get_linear_velocity">
  198. The body's linear velocity.
  199. </member>
  200. <member name="principal_inertia_axes" type="Basis" setter="" getter="get_principal_inertia_axes">
  201. </member>
  202. <member name="sleeping" type="bool" setter="set_sleep_state" getter="is_sleeping">
  203. If [code]true[/code], this body is currently sleeping (not active).
  204. </member>
  205. <member name="step" type="float" setter="" getter="get_step">
  206. The timestep (delta) used for the simulation.
  207. </member>
  208. <member name="total_angular_damp" type="float" setter="" getter="get_total_angular_damp">
  209. The rate at which the body stops rotating, if there are not any other forces moving it.
  210. </member>
  211. <member name="total_gravity" type="Vector3" setter="" getter="get_total_gravity">
  212. The total gravity vector being currently applied to this body.
  213. </member>
  214. <member name="total_linear_damp" type="float" setter="" getter="get_total_linear_damp">
  215. The rate at which the body stops moving, if there are not any other forces moving it.
  216. </member>
  217. <member name="transform" type="Transform" setter="set_transform" getter="get_transform">
  218. The body's transformation matrix.
  219. </member>
  220. </members>
  221. <constants>
  222. </constants>
  223. </class>