class_physics2ddirectbodystate.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Physics2DDirectBodyState.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Physics2DDirectBodyState:
  5. Physics2DDirectBodyState
  6. ========================
  7. **Inherits:** :ref:`Object<class_object>`
  8. **Inherited By:** :ref:`Physics2DDirectBodyStateSW<class_physics2ddirectbodystatesw>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Direct access object to a physics body in the :ref:`Physics2DServer<class_physics2dserver>`.
  13. Member Functions
  14. ----------------
  15. +--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | :ref:`RID<class_rid>` | :ref:`get_contact_collider<class_Physics2DDirectBodyState_get_contact_collider>` **(** :ref:`int<class_int>` contact_idx **)** const |
  17. +--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`int<class_int>` | :ref:`get_contact_collider_id<class_Physics2DDirectBodyState_get_contact_collider_id>` **(** :ref:`int<class_int>` contact_idx **)** const |
  19. +--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`Object<class_object>` | :ref:`get_contact_collider_object<class_Physics2DDirectBodyState_get_contact_collider_object>` **(** :ref:`int<class_int>` contact_idx **)** const |
  21. +--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`Vector2<class_vector2>` | :ref:`get_contact_collider_position<class_Physics2DDirectBodyState_get_contact_collider_position>` **(** :ref:`int<class_int>` contact_idx **)** const |
  23. +--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`int<class_int>` | :ref:`get_contact_collider_shape<class_Physics2DDirectBodyState_get_contact_collider_shape>` **(** :ref:`int<class_int>` contact_idx **)** const |
  25. +--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`Variant<class_variant>` | :ref:`get_contact_collider_shape_metadata<class_Physics2DDirectBodyState_get_contact_collider_shape_metadata>` **(** :ref:`int<class_int>` contact_idx **)** const |
  27. +--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`Vector2<class_vector2>` | :ref:`get_contact_collider_velocity_at_position<class_Physics2DDirectBodyState_get_contact_collider_velocity_at_position>` **(** :ref:`int<class_int>` contact_idx **)** const |
  29. +--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`int<class_int>` | :ref:`get_contact_count<class_Physics2DDirectBodyState_get_contact_count>` **(** **)** const |
  31. +--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`Vector2<class_vector2>` | :ref:`get_contact_local_normal<class_Physics2DDirectBodyState_get_contact_local_normal>` **(** :ref:`int<class_int>` contact_idx **)** const |
  33. +--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`Vector2<class_vector2>` | :ref:`get_contact_local_position<class_Physics2DDirectBodyState_get_contact_local_position>` **(** :ref:`int<class_int>` contact_idx **)** const |
  35. +--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`int<class_int>` | :ref:`get_contact_local_shape<class_Physics2DDirectBodyState_get_contact_local_shape>` **(** :ref:`int<class_int>` contact_idx **)** const |
  37. +--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`Physics2DDirectSpaceState<class_physics2ddirectspacestate>` | :ref:`get_space_state<class_Physics2DDirectBodyState_get_space_state>` **(** **)** |
  39. +--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | void | :ref:`integrate_forces<class_Physics2DDirectBodyState_integrate_forces>` **(** **)** |
  41. +--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. Member Variables
  43. ----------------
  44. .. _class_Physics2DDirectBodyState_angular_velocity:
  45. - :ref:`float<class_float>` **angular_velocity** - The angular velocity of the body.
  46. .. _class_Physics2DDirectBodyState_inverse_inertia:
  47. - :ref:`float<class_float>` **inverse_inertia** - The inverse of the inertia of the body.
  48. .. _class_Physics2DDirectBodyState_inverse_mass:
  49. - :ref:`float<class_float>` **inverse_mass** - The inverse of the mass of the body.
  50. .. _class_Physics2DDirectBodyState_linear_velocity:
  51. - :ref:`Vector2<class_vector2>` **linear_velocity** - The linear velocity of the body.
  52. .. _class_Physics2DDirectBodyState_sleeping:
  53. - :ref:`bool<class_bool>` **sleeping** - ``true`` if this body is currently sleeping (not active).
  54. .. _class_Physics2DDirectBodyState_step:
  55. - :ref:`float<class_float>` **step** - The timestep (delta) used for the simulation.
  56. .. _class_Physics2DDirectBodyState_total_angular_damp:
  57. - :ref:`float<class_float>` **total_angular_damp** - The rate at which the body stops rotating, if there are not any other forces moving it.
  58. .. _class_Physics2DDirectBodyState_total_gravity:
  59. - :ref:`Vector2<class_vector2>` **total_gravity** - The total gravity vector being currently applied to this body.
  60. .. _class_Physics2DDirectBodyState_total_linear_damp:
  61. - :ref:`float<class_float>` **total_linear_damp** - The rate at which the body stops moving, if there are not any other forces moving it.
  62. .. _class_Physics2DDirectBodyState_transform:
  63. - :ref:`Transform2D<class_transform2d>` **transform** - The transformation matrix of the body.
  64. Description
  65. -----------
  66. 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.
  67. Member Function Description
  68. ---------------------------
  69. .. _class_Physics2DDirectBodyState_get_contact_collider:
  70. - :ref:`RID<class_rid>` **get_contact_collider** **(** :ref:`int<class_int>` contact_idx **)** const
  71. Return the :ref:`RID<class_rid>` of the collider.
  72. .. _class_Physics2DDirectBodyState_get_contact_collider_id:
  73. - :ref:`int<class_int>` **get_contact_collider_id** **(** :ref:`int<class_int>` contact_idx **)** const
  74. Return the object id of the collider.
  75. .. _class_Physics2DDirectBodyState_get_contact_collider_object:
  76. - :ref:`Object<class_object>` **get_contact_collider_object** **(** :ref:`int<class_int>` contact_idx **)** const
  77. Return the collider object, this depends on how it was created (will return a scene node if such was used to create it).
  78. .. _class_Physics2DDirectBodyState_get_contact_collider_position:
  79. - :ref:`Vector2<class_vector2>` **get_contact_collider_position** **(** :ref:`int<class_int>` contact_idx **)** const
  80. Return the contact position in the collider.
  81. .. _class_Physics2DDirectBodyState_get_contact_collider_shape:
  82. - :ref:`int<class_int>` **get_contact_collider_shape** **(** :ref:`int<class_int>` contact_idx **)** const
  83. Return the collider shape index.
  84. .. _class_Physics2DDirectBodyState_get_contact_collider_shape_metadata:
  85. - :ref:`Variant<class_variant>` **get_contact_collider_shape_metadata** **(** :ref:`int<class_int>` contact_idx **)** const
  86. Return the metadata of the collided shape. This metadata is different from :ref:`Object.get_meta<class_Object_get_meta>`, and is set with :ref:`Physics2DServer.shape_set_data<class_Physics2DServer_shape_set_data>`.
  87. .. _class_Physics2DDirectBodyState_get_contact_collider_velocity_at_position:
  88. - :ref:`Vector2<class_vector2>` **get_contact_collider_velocity_at_position** **(** :ref:`int<class_int>` contact_idx **)** const
  89. Return the linear velocity vector at contact point of the collider.
  90. .. _class_Physics2DDirectBodyState_get_contact_count:
  91. - :ref:`int<class_int>` **get_contact_count** **(** **)** const
  92. 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.
  93. .. _class_Physics2DDirectBodyState_get_contact_local_normal:
  94. - :ref:`Vector2<class_vector2>` **get_contact_local_normal** **(** :ref:`int<class_int>` contact_idx **)** const
  95. Return the local normal (of this body) of the contact point.
  96. .. _class_Physics2DDirectBodyState_get_contact_local_position:
  97. - :ref:`Vector2<class_vector2>` **get_contact_local_position** **(** :ref:`int<class_int>` contact_idx **)** const
  98. Return the local position (of this body) of the contact point.
  99. .. _class_Physics2DDirectBodyState_get_contact_local_shape:
  100. - :ref:`int<class_int>` **get_contact_local_shape** **(** :ref:`int<class_int>` contact_idx **)** const
  101. Return the local shape index of the collision.
  102. .. _class_Physics2DDirectBodyState_get_space_state:
  103. - :ref:`Physics2DDirectSpaceState<class_physics2ddirectspacestate>` **get_space_state** **(** **)**
  104. Return the current state of space, useful for queries.
  105. .. _class_Physics2DDirectBodyState_integrate_forces:
  106. - void **integrate_forces** **(** **)**
  107. Call the built-in force integration code.