class_physics2ddirectbodystate.rst 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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_Physics2DDirectBodyState:
  4. Physics2DDirectBodyState
  5. ========================
  6. **Inherits:** :ref:`Object<class_object>`
  7. **Inherited By:** :ref:`Physics2DDirectBodyStateSW<class_physics2ddirectbodystatesw>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Direct access object to a physics body in the :ref:`Physics2DServer<class_physics2dserver>`.
  12. Member Functions
  13. ----------------
  14. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | :ref:`Vector2<class_vector2>` | :ref:`get_total_gravity<class_Physics2DDirectBodyState_get_total_gravity>` **(** **)** const |
  16. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`float<class_float>` | :ref:`get_total_linear_damp<class_Physics2DDirectBodyState_get_total_linear_damp>` **(** **)** const |
  18. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`float<class_float>` | :ref:`get_total_angular_damp<class_Physics2DDirectBodyState_get_total_angular_damp>` **(** **)** const |
  20. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`float<class_float>` | :ref:`get_inverse_mass<class_Physics2DDirectBodyState_get_inverse_mass>` **(** **)** const |
  22. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`float<class_float>` | :ref:`get_inverse_inertia<class_Physics2DDirectBodyState_get_inverse_inertia>` **(** **)** const |
  24. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | void | :ref:`set_linear_velocity<class_Physics2DDirectBodyState_set_linear_velocity>` **(** :ref:`Vector2<class_vector2>` velocity **)** |
  26. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`Vector2<class_vector2>` | :ref:`get_linear_velocity<class_Physics2DDirectBodyState_get_linear_velocity>` **(** **)** const |
  28. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | void | :ref:`set_angular_velocity<class_Physics2DDirectBodyState_set_angular_velocity>` **(** :ref:`float<class_float>` velocity **)** |
  30. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`float<class_float>` | :ref:`get_angular_velocity<class_Physics2DDirectBodyState_get_angular_velocity>` **(** **)** const |
  32. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`set_transform<class_Physics2DDirectBodyState_set_transform>` **(** :ref:`Matrix32<class_matrix32>` transform **)** |
  34. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`Matrix32<class_matrix32>` | :ref:`get_transform<class_Physics2DDirectBodyState_get_transform>` **(** **)** const |
  36. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | void | :ref:`set_sleep_state<class_Physics2DDirectBodyState_set_sleep_state>` **(** :ref:`bool<class_bool>` enabled **)** |
  38. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`bool<class_bool>` | :ref:`is_sleeping<class_Physics2DDirectBodyState_is_sleeping>` **(** **)** const |
  40. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`int<class_int>` | :ref:`get_contact_count<class_Physics2DDirectBodyState_get_contact_count>` **(** **)** const |
  42. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`Vector2<class_vector2>` | :ref:`get_contact_local_pos<class_Physics2DDirectBodyState_get_contact_local_pos>` **(** :ref:`int<class_int>` contact_idx **)** const |
  44. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`Vector2<class_vector2>` | :ref:`get_contact_local_normal<class_Physics2DDirectBodyState_get_contact_local_normal>` **(** :ref:`int<class_int>` contact_idx **)** const |
  46. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`int<class_int>` | :ref:`get_contact_local_shape<class_Physics2DDirectBodyState_get_contact_local_shape>` **(** :ref:`int<class_int>` contact_idx **)** const |
  48. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`RID<class_rid>` | :ref:`get_contact_collider<class_Physics2DDirectBodyState_get_contact_collider>` **(** :ref:`int<class_int>` contact_idx **)** const |
  50. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`Vector2<class_vector2>` | :ref:`get_contact_collider_pos<class_Physics2DDirectBodyState_get_contact_collider_pos>` **(** :ref:`int<class_int>` contact_idx **)** const |
  52. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`int<class_int>` | :ref:`get_contact_collider_id<class_Physics2DDirectBodyState_get_contact_collider_id>` **(** :ref:`int<class_int>` contact_idx **)** const |
  54. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`Object<class_object>` | :ref:`get_contact_collider_object<class_Physics2DDirectBodyState_get_contact_collider_object>` **(** :ref:`int<class_int>` contact_idx **)** const |
  56. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`int<class_int>` | :ref:`get_contact_collider_shape<class_Physics2DDirectBodyState_get_contact_collider_shape>` **(** :ref:`int<class_int>` contact_idx **)** const |
  58. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | Variant | :ref:`get_contact_collider_shape_metadata<class_Physics2DDirectBodyState_get_contact_collider_shape_metadata>` **(** :ref:`int<class_int>` contact_idx **)** const |
  60. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`Vector2<class_vector2>` | :ref:`get_contact_collider_velocity_at_pos<class_Physics2DDirectBodyState_get_contact_collider_velocity_at_pos>` **(** :ref:`int<class_int>` contact_idx **)** const |
  62. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | :ref:`float<class_float>` | :ref:`get_step<class_Physics2DDirectBodyState_get_step>` **(** **)** const |
  64. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | void | :ref:`integrate_forces<class_Physics2DDirectBodyState_integrate_forces>` **(** **)** |
  66. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | :ref:`Physics2DDirectSpaceState<class_physics2ddirectspacestate>` | :ref:`get_space_state<class_Physics2DDirectBodyState_get_space_state>` **(** **)** |
  68. +--------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. Description
  70. -----------
  71. Direct access object to a physics body in the :ref:`Physics2DServer<class_physics2dserver>`. This object is passed via the direct state callback of rigid/character bodies, and is intended for changing the direct state of that body.
  72. Member Function Description
  73. ---------------------------
  74. .. _class_Physics2DDirectBodyState_get_total_gravity:
  75. - :ref:`Vector2<class_vector2>` **get_total_gravity** **(** **)** const
  76. Return the total gravity vector being currently applied to this body.
  77. .. _class_Physics2DDirectBodyState_get_total_linear_damp:
  78. - :ref:`float<class_float>` **get_total_linear_damp** **(** **)** const
  79. .. _class_Physics2DDirectBodyState_get_total_angular_damp:
  80. - :ref:`float<class_float>` **get_total_angular_damp** **(** **)** const
  81. .. _class_Physics2DDirectBodyState_get_inverse_mass:
  82. - :ref:`float<class_float>` **get_inverse_mass** **(** **)** const
  83. Return the inverse of the mass of the body.
  84. .. _class_Physics2DDirectBodyState_get_inverse_inertia:
  85. - :ref:`float<class_float>` **get_inverse_inertia** **(** **)** const
  86. Return the inverse of the inertia of the body.
  87. .. _class_Physics2DDirectBodyState_set_linear_velocity:
  88. - void **set_linear_velocity** **(** :ref:`Vector2<class_vector2>` velocity **)**
  89. Change the linear velocity of the body.
  90. .. _class_Physics2DDirectBodyState_get_linear_velocity:
  91. - :ref:`Vector2<class_vector2>` **get_linear_velocity** **(** **)** const
  92. Return the current linear velocity of the body.
  93. .. _class_Physics2DDirectBodyState_set_angular_velocity:
  94. - void **set_angular_velocity** **(** :ref:`float<class_float>` velocity **)**
  95. Change the angular velocity of the body.
  96. .. _class_Physics2DDirectBodyState_get_angular_velocity:
  97. - :ref:`float<class_float>` **get_angular_velocity** **(** **)** const
  98. Return the angular velocity of the body.
  99. .. _class_Physics2DDirectBodyState_set_transform:
  100. - void **set_transform** **(** :ref:`Matrix32<class_matrix32>` transform **)**
  101. Change the transform matrix of the body.
  102. .. _class_Physics2DDirectBodyState_get_transform:
  103. - :ref:`Matrix32<class_matrix32>` **get_transform** **(** **)** const
  104. Return the transform matrix of the body.
  105. .. _class_Physics2DDirectBodyState_set_sleep_state:
  106. - void **set_sleep_state** **(** :ref:`bool<class_bool>` enabled **)**
  107. Set the sleeping state of the body, only affects character/rigid bodies.
  108. .. _class_Physics2DDirectBodyState_is_sleeping:
  109. - :ref:`bool<class_bool>` **is_sleeping** **(** **)** const
  110. Return true if this body is currently sleeping (not active).
  111. .. _class_Physics2DDirectBodyState_get_contact_count:
  112. - :ref:`int<class_int>` **get_contact_count** **(** **)** const
  113. Return the amount of contacts this body has with other bodies. Note that by default this returns 0 unless bodies are configured to log contacts.
  114. .. _class_Physics2DDirectBodyState_get_contact_local_pos:
  115. - :ref:`Vector2<class_vector2>` **get_contact_local_pos** **(** :ref:`int<class_int>` contact_idx **)** const
  116. Return the local position (of this body) of the contact point.
  117. .. _class_Physics2DDirectBodyState_get_contact_local_normal:
  118. - :ref:`Vector2<class_vector2>` **get_contact_local_normal** **(** :ref:`int<class_int>` contact_idx **)** const
  119. .. _class_Physics2DDirectBodyState_get_contact_local_shape:
  120. - :ref:`int<class_int>` **get_contact_local_shape** **(** :ref:`int<class_int>` contact_idx **)** const
  121. Return the local shape index of the collision.
  122. .. _class_Physics2DDirectBodyState_get_contact_collider:
  123. - :ref:`RID<class_rid>` **get_contact_collider** **(** :ref:`int<class_int>` contact_idx **)** const
  124. Return the RID of the collider.
  125. .. _class_Physics2DDirectBodyState_get_contact_collider_pos:
  126. - :ref:`Vector2<class_vector2>` **get_contact_collider_pos** **(** :ref:`int<class_int>` contact_idx **)** const
  127. Return the contact position in the collider.
  128. .. _class_Physics2DDirectBodyState_get_contact_collider_id:
  129. - :ref:`int<class_int>` **get_contact_collider_id** **(** :ref:`int<class_int>` contact_idx **)** const
  130. Return the object id of the collider.
  131. .. _class_Physics2DDirectBodyState_get_contact_collider_object:
  132. - :ref:`Object<class_object>` **get_contact_collider_object** **(** :ref:`int<class_int>` contact_idx **)** const
  133. Return the collider object, this depends on how it was created (will return a scene node if such was used to create it).
  134. .. _class_Physics2DDirectBodyState_get_contact_collider_shape:
  135. - :ref:`int<class_int>` **get_contact_collider_shape** **(** :ref:`int<class_int>` contact_idx **)** const
  136. Return the collider shape index.
  137. .. _class_Physics2DDirectBodyState_get_contact_collider_shape_metadata:
  138. - Variant **get_contact_collider_shape_metadata** **(** :ref:`int<class_int>` contact_idx **)** const
  139. .. _class_Physics2DDirectBodyState_get_contact_collider_velocity_at_pos:
  140. - :ref:`Vector2<class_vector2>` **get_contact_collider_velocity_at_pos** **(** :ref:`int<class_int>` contact_idx **)** const
  141. Return the linear velocity vector at contact point of the collider.
  142. .. _class_Physics2DDirectBodyState_get_step:
  143. - :ref:`float<class_float>` **get_step** **(** **)** const
  144. Return the timestep (delta) used for the simulation.
  145. .. _class_Physics2DDirectBodyState_integrate_forces:
  146. - void **integrate_forces** **(** **)**
  147. Call the built-in force integration code.
  148. .. _class_Physics2DDirectBodyState_get_space_state:
  149. - :ref:`Physics2DDirectSpaceState<class_physics2ddirectspacestate>` **get_space_state** **(** **)**
  150. Return the current state of space, useful for queries.