PhysicsDirectBodyState.xml 8.1 KB

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