PhysicsDirectBodyState.xml 7.4 KB

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