class_kinematiccollision3d.rst 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/KinematicCollision3D.xml.
  6. .. _class_KinematicCollision3D:
  7. KinematicCollision3D
  8. ====================
  9. **Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Holds collision data from the movement of a :ref:`PhysicsBody3D<class_PhysicsBody3D>`.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Holds collision data from the movement of a :ref:`PhysicsBody3D<class_PhysicsBody3D>`, usually from :ref:`PhysicsBody3D.move_and_collide<class_PhysicsBody3D_method_move_and_collide>`. When a :ref:`PhysicsBody3D<class_PhysicsBody3D>` is moved, it stops if it detects a collision with another body. If a collision is detected, a **KinematicCollision3D** object is returned.
  15. The collision data includes the colliding object, the remaining motion, and the collision position. This data can be used to determine a custom response to the collision.
  16. .. rst-class:: classref-reftable-group
  17. Methods
  18. -------
  19. .. table::
  20. :widths: auto
  21. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`float<class_float>` | :ref:`get_angle<class_KinematicCollision3D_method_get_angle>`\ (\ collision_index\: :ref:`int<class_int>` = 0, up_direction\: :ref:`Vector3<class_Vector3>` = Vector3(0, 1, 0)\ ) |const| |
  23. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`Object<class_Object>` | :ref:`get_collider<class_KinematicCollision3D_method_get_collider>`\ (\ collision_index\: :ref:`int<class_int>` = 0\ ) |const| |
  25. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`int<class_int>` | :ref:`get_collider_id<class_KinematicCollision3D_method_get_collider_id>`\ (\ collision_index\: :ref:`int<class_int>` = 0\ ) |const| |
  27. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`RID<class_RID>` | :ref:`get_collider_rid<class_KinematicCollision3D_method_get_collider_rid>`\ (\ collision_index\: :ref:`int<class_int>` = 0\ ) |const| |
  29. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`Object<class_Object>` | :ref:`get_collider_shape<class_KinematicCollision3D_method_get_collider_shape>`\ (\ collision_index\: :ref:`int<class_int>` = 0\ ) |const| |
  31. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`int<class_int>` | :ref:`get_collider_shape_index<class_KinematicCollision3D_method_get_collider_shape_index>`\ (\ collision_index\: :ref:`int<class_int>` = 0\ ) |const| |
  33. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`Vector3<class_Vector3>` | :ref:`get_collider_velocity<class_KinematicCollision3D_method_get_collider_velocity>`\ (\ collision_index\: :ref:`int<class_int>` = 0\ ) |const| |
  35. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`int<class_int>` | :ref:`get_collision_count<class_KinematicCollision3D_method_get_collision_count>`\ (\ ) |const| |
  37. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`float<class_float>` | :ref:`get_depth<class_KinematicCollision3D_method_get_depth>`\ (\ ) |const| |
  39. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`Object<class_Object>` | :ref:`get_local_shape<class_KinematicCollision3D_method_get_local_shape>`\ (\ collision_index\: :ref:`int<class_int>` = 0\ ) |const| |
  41. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`Vector3<class_Vector3>` | :ref:`get_normal<class_KinematicCollision3D_method_get_normal>`\ (\ collision_index\: :ref:`int<class_int>` = 0\ ) |const| |
  43. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`Vector3<class_Vector3>` | :ref:`get_position<class_KinematicCollision3D_method_get_position>`\ (\ collision_index\: :ref:`int<class_int>` = 0\ ) |const| |
  45. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`Vector3<class_Vector3>` | :ref:`get_remainder<class_KinematicCollision3D_method_get_remainder>`\ (\ ) |const| |
  47. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`Vector3<class_Vector3>` | :ref:`get_travel<class_KinematicCollision3D_method_get_travel>`\ (\ ) |const| |
  49. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. .. rst-class:: classref-section-separator
  51. ----
  52. .. rst-class:: classref-descriptions-group
  53. Method Descriptions
  54. -------------------
  55. .. _class_KinematicCollision3D_method_get_angle:
  56. .. rst-class:: classref-method
  57. :ref:`float<class_float>` **get_angle**\ (\ collision_index\: :ref:`int<class_int>` = 0, up_direction\: :ref:`Vector3<class_Vector3>` = Vector3(0, 1, 0)\ ) |const| :ref:`🔗<class_KinematicCollision3D_method_get_angle>`
  58. Returns the collision angle according to ``up_direction``, which is :ref:`Vector3.UP<class_Vector3_constant_UP>` by default. This value is always positive.
  59. .. rst-class:: classref-item-separator
  60. ----
  61. .. _class_KinematicCollision3D_method_get_collider:
  62. .. rst-class:: classref-method
  63. :ref:`Object<class_Object>` **get_collider**\ (\ collision_index\: :ref:`int<class_int>` = 0\ ) |const| :ref:`🔗<class_KinematicCollision3D_method_get_collider>`
  64. Returns the colliding body's attached :ref:`Object<class_Object>` given a collision index (the deepest collision by default).
  65. .. rst-class:: classref-item-separator
  66. ----
  67. .. _class_KinematicCollision3D_method_get_collider_id:
  68. .. rst-class:: classref-method
  69. :ref:`int<class_int>` **get_collider_id**\ (\ collision_index\: :ref:`int<class_int>` = 0\ ) |const| :ref:`🔗<class_KinematicCollision3D_method_get_collider_id>`
  70. Returns the unique instance ID of the colliding body's attached :ref:`Object<class_Object>` given a collision index (the deepest collision by default). See :ref:`Object.get_instance_id<class_Object_method_get_instance_id>`.
  71. .. rst-class:: classref-item-separator
  72. ----
  73. .. _class_KinematicCollision3D_method_get_collider_rid:
  74. .. rst-class:: classref-method
  75. :ref:`RID<class_RID>` **get_collider_rid**\ (\ collision_index\: :ref:`int<class_int>` = 0\ ) |const| :ref:`🔗<class_KinematicCollision3D_method_get_collider_rid>`
  76. Returns the colliding body's :ref:`RID<class_RID>` used by the :ref:`PhysicsServer3D<class_PhysicsServer3D>` given a collision index (the deepest collision by default).
  77. .. rst-class:: classref-item-separator
  78. ----
  79. .. _class_KinematicCollision3D_method_get_collider_shape:
  80. .. rst-class:: classref-method
  81. :ref:`Object<class_Object>` **get_collider_shape**\ (\ collision_index\: :ref:`int<class_int>` = 0\ ) |const| :ref:`🔗<class_KinematicCollision3D_method_get_collider_shape>`
  82. Returns the colliding body's shape given a collision index (the deepest collision by default).
  83. .. rst-class:: classref-item-separator
  84. ----
  85. .. _class_KinematicCollision3D_method_get_collider_shape_index:
  86. .. rst-class:: classref-method
  87. :ref:`int<class_int>` **get_collider_shape_index**\ (\ collision_index\: :ref:`int<class_int>` = 0\ ) |const| :ref:`🔗<class_KinematicCollision3D_method_get_collider_shape_index>`
  88. Returns the colliding body's shape index given a collision index (the deepest collision by default). See :ref:`CollisionObject3D<class_CollisionObject3D>`.
  89. .. rst-class:: classref-item-separator
  90. ----
  91. .. _class_KinematicCollision3D_method_get_collider_velocity:
  92. .. rst-class:: classref-method
  93. :ref:`Vector3<class_Vector3>` **get_collider_velocity**\ (\ collision_index\: :ref:`int<class_int>` = 0\ ) |const| :ref:`🔗<class_KinematicCollision3D_method_get_collider_velocity>`
  94. Returns the colliding body's velocity given a collision index (the deepest collision by default).
  95. .. rst-class:: classref-item-separator
  96. ----
  97. .. _class_KinematicCollision3D_method_get_collision_count:
  98. .. rst-class:: classref-method
  99. :ref:`int<class_int>` **get_collision_count**\ (\ ) |const| :ref:`🔗<class_KinematicCollision3D_method_get_collision_count>`
  100. Returns the number of detected collisions.
  101. .. rst-class:: classref-item-separator
  102. ----
  103. .. _class_KinematicCollision3D_method_get_depth:
  104. .. rst-class:: classref-method
  105. :ref:`float<class_float>` **get_depth**\ (\ ) |const| :ref:`🔗<class_KinematicCollision3D_method_get_depth>`
  106. Returns the colliding body's length of overlap along the collision normal.
  107. .. rst-class:: classref-item-separator
  108. ----
  109. .. _class_KinematicCollision3D_method_get_local_shape:
  110. .. rst-class:: classref-method
  111. :ref:`Object<class_Object>` **get_local_shape**\ (\ collision_index\: :ref:`int<class_int>` = 0\ ) |const| :ref:`🔗<class_KinematicCollision3D_method_get_local_shape>`
  112. Returns the moving object's colliding shape given a collision index (the deepest collision by default).
  113. .. rst-class:: classref-item-separator
  114. ----
  115. .. _class_KinematicCollision3D_method_get_normal:
  116. .. rst-class:: classref-method
  117. :ref:`Vector3<class_Vector3>` **get_normal**\ (\ collision_index\: :ref:`int<class_int>` = 0\ ) |const| :ref:`🔗<class_KinematicCollision3D_method_get_normal>`
  118. Returns the colliding body's shape's normal at the point of collision given a collision index (the deepest collision by default).
  119. .. rst-class:: classref-item-separator
  120. ----
  121. .. _class_KinematicCollision3D_method_get_position:
  122. .. rst-class:: classref-method
  123. :ref:`Vector3<class_Vector3>` **get_position**\ (\ collision_index\: :ref:`int<class_int>` = 0\ ) |const| :ref:`🔗<class_KinematicCollision3D_method_get_position>`
  124. Returns the point of collision in global coordinates given a collision index (the deepest collision by default).
  125. .. rst-class:: classref-item-separator
  126. ----
  127. .. _class_KinematicCollision3D_method_get_remainder:
  128. .. rst-class:: classref-method
  129. :ref:`Vector3<class_Vector3>` **get_remainder**\ (\ ) |const| :ref:`🔗<class_KinematicCollision3D_method_get_remainder>`
  130. Returns the moving object's remaining movement vector.
  131. .. rst-class:: classref-item-separator
  132. ----
  133. .. _class_KinematicCollision3D_method_get_travel:
  134. .. rst-class:: classref-method
  135. :ref:`Vector3<class_Vector3>` **get_travel**\ (\ ) |const| :ref:`🔗<class_KinematicCollision3D_method_get_travel>`
  136. Returns the moving object's travel before collision.
  137. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  138. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  139. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  140. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  141. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  142. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  143. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  144. .. |void| replace:: :abbr:`void (No return value.)`