class_kinematiccollision.rst 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the KinematicCollision.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_KinematicCollision:
  6. KinematicCollision
  7. ==================
  8. **Inherits:** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. Collision data for :ref:`KinematicBody<class_KinematicBody>` collisions.
  10. Description
  11. -----------
  12. Contains collision data for :ref:`KinematicBody<class_KinematicBody>` collisions. When a :ref:`KinematicBody<class_KinematicBody>` is moved using :ref:`KinematicBody.move_and_collide<class_KinematicBody_method_move_and_collide>`, it stops if it detects a collision with another body. If a collision is detected, a KinematicCollision object is returned.
  13. This object contains information about the collision, including the colliding object, the remaining motion, and the collision position. This information can be used to calculate a collision response.
  14. Properties
  15. ----------
  16. +-------------------------------+-------------------------------------------------------------------------------------+------------------------+
  17. | :ref:`Object<class_Object>` | :ref:`collider<class_KinematicCollision_property_collider>` | |
  18. +-------------------------------+-------------------------------------------------------------------------------------+------------------------+
  19. | :ref:`int<class_int>` | :ref:`collider_id<class_KinematicCollision_property_collider_id>` | ``0`` |
  20. +-------------------------------+-------------------------------------------------------------------------------------+------------------------+
  21. | :ref:`Variant<class_Variant>` | :ref:`collider_metadata<class_KinematicCollision_property_collider_metadata>` | |
  22. +-------------------------------+-------------------------------------------------------------------------------------+------------------------+
  23. | :ref:`RID<class_RID>` | :ref:`collider_rid<class_KinematicCollision_property_collider_rid>` | |
  24. +-------------------------------+-------------------------------------------------------------------------------------+------------------------+
  25. | :ref:`Object<class_Object>` | :ref:`collider_shape<class_KinematicCollision_property_collider_shape>` | |
  26. +-------------------------------+-------------------------------------------------------------------------------------+------------------------+
  27. | :ref:`int<class_int>` | :ref:`collider_shape_index<class_KinematicCollision_property_collider_shape_index>` | ``0`` |
  28. +-------------------------------+-------------------------------------------------------------------------------------+------------------------+
  29. | :ref:`Vector3<class_Vector3>` | :ref:`collider_velocity<class_KinematicCollision_property_collider_velocity>` | ``Vector3( 0, 0, 0 )`` |
  30. +-------------------------------+-------------------------------------------------------------------------------------+------------------------+
  31. | :ref:`Object<class_Object>` | :ref:`local_shape<class_KinematicCollision_property_local_shape>` | |
  32. +-------------------------------+-------------------------------------------------------------------------------------+------------------------+
  33. | :ref:`Vector3<class_Vector3>` | :ref:`normal<class_KinematicCollision_property_normal>` | ``Vector3( 0, 0, 0 )`` |
  34. +-------------------------------+-------------------------------------------------------------------------------------+------------------------+
  35. | :ref:`Vector3<class_Vector3>` | :ref:`position<class_KinematicCollision_property_position>` | ``Vector3( 0, 0, 0 )`` |
  36. +-------------------------------+-------------------------------------------------------------------------------------+------------------------+
  37. | :ref:`Vector3<class_Vector3>` | :ref:`remainder<class_KinematicCollision_property_remainder>` | ``Vector3( 0, 0, 0 )`` |
  38. +-------------------------------+-------------------------------------------------------------------------------------+------------------------+
  39. | :ref:`Vector3<class_Vector3>` | :ref:`travel<class_KinematicCollision_property_travel>` | ``Vector3( 0, 0, 0 )`` |
  40. +-------------------------------+-------------------------------------------------------------------------------------+------------------------+
  41. Property Descriptions
  42. ---------------------
  43. .. _class_KinematicCollision_property_collider:
  44. - :ref:`Object<class_Object>` **collider**
  45. +----------+----------------+
  46. | *Getter* | get_collider() |
  47. +----------+----------------+
  48. The colliding body.
  49. ----
  50. .. _class_KinematicCollision_property_collider_id:
  51. - :ref:`int<class_int>` **collider_id**
  52. +-----------+-------------------+
  53. | *Default* | ``0`` |
  54. +-----------+-------------------+
  55. | *Getter* | get_collider_id() |
  56. +-----------+-------------------+
  57. The colliding body's unique instance ID. See :ref:`Object.get_instance_id<class_Object_method_get_instance_id>`.
  58. ----
  59. .. _class_KinematicCollision_property_collider_metadata:
  60. - :ref:`Variant<class_Variant>` **collider_metadata**
  61. +----------+-------------------------+
  62. | *Getter* | get_collider_metadata() |
  63. +----------+-------------------------+
  64. The colliding body's metadata. See :ref:`Object<class_Object>`.
  65. ----
  66. .. _class_KinematicCollision_property_collider_rid:
  67. - :ref:`RID<class_RID>` **collider_rid**
  68. +----------+--------------------+
  69. | *Getter* | get_collider_rid() |
  70. +----------+--------------------+
  71. The colliding body's :ref:`RID<class_RID>` used by the :ref:`PhysicsServer<class_PhysicsServer>`.
  72. ----
  73. .. _class_KinematicCollision_property_collider_shape:
  74. - :ref:`Object<class_Object>` **collider_shape**
  75. +----------+----------------------+
  76. | *Getter* | get_collider_shape() |
  77. +----------+----------------------+
  78. The colliding body's shape.
  79. ----
  80. .. _class_KinematicCollision_property_collider_shape_index:
  81. - :ref:`int<class_int>` **collider_shape_index**
  82. +-----------+----------------------------+
  83. | *Default* | ``0`` |
  84. +-----------+----------------------------+
  85. | *Getter* | get_collider_shape_index() |
  86. +-----------+----------------------------+
  87. The colliding shape's index. See :ref:`CollisionObject<class_CollisionObject>`.
  88. ----
  89. .. _class_KinematicCollision_property_collider_velocity:
  90. - :ref:`Vector3<class_Vector3>` **collider_velocity**
  91. +-----------+-------------------------+
  92. | *Default* | ``Vector3( 0, 0, 0 )`` |
  93. +-----------+-------------------------+
  94. | *Getter* | get_collider_velocity() |
  95. +-----------+-------------------------+
  96. The colliding object's velocity.
  97. ----
  98. .. _class_KinematicCollision_property_local_shape:
  99. - :ref:`Object<class_Object>` **local_shape**
  100. +----------+-------------------+
  101. | *Getter* | get_local_shape() |
  102. +----------+-------------------+
  103. The moving object's colliding shape.
  104. ----
  105. .. _class_KinematicCollision_property_normal:
  106. - :ref:`Vector3<class_Vector3>` **normal**
  107. +-----------+------------------------+
  108. | *Default* | ``Vector3( 0, 0, 0 )`` |
  109. +-----------+------------------------+
  110. | *Getter* | get_normal() |
  111. +-----------+------------------------+
  112. The colliding body's shape's normal at the point of collision.
  113. ----
  114. .. _class_KinematicCollision_property_position:
  115. - :ref:`Vector3<class_Vector3>` **position**
  116. +-----------+------------------------+
  117. | *Default* | ``Vector3( 0, 0, 0 )`` |
  118. +-----------+------------------------+
  119. | *Getter* | get_position() |
  120. +-----------+------------------------+
  121. The point of collision, in global coordinates.
  122. ----
  123. .. _class_KinematicCollision_property_remainder:
  124. - :ref:`Vector3<class_Vector3>` **remainder**
  125. +-----------+------------------------+
  126. | *Default* | ``Vector3( 0, 0, 0 )`` |
  127. +-----------+------------------------+
  128. | *Getter* | get_remainder() |
  129. +-----------+------------------------+
  130. The moving object's remaining movement vector.
  131. ----
  132. .. _class_KinematicCollision_property_travel:
  133. - :ref:`Vector3<class_Vector3>` **travel**
  134. +-----------+------------------------+
  135. | *Default* | ``Vector3( 0, 0, 0 )`` |
  136. +-----------+------------------------+
  137. | *Getter* | get_travel() |
  138. +-----------+------------------------+
  139. The distance the moving object traveled before collision.
  140. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  141. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  142. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`