class_kinematiccollision.rst 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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:`Object<class_Object>` | :ref:`collider_shape<class_KinematicCollision_property_collider_shape>` | |
  24. +-------------------------------+-------------------------------------------------------------------------------------+------------------------+
  25. | :ref:`int<class_int>` | :ref:`collider_shape_index<class_KinematicCollision_property_collider_shape_index>` | ``0`` |
  26. +-------------------------------+-------------------------------------------------------------------------------------+------------------------+
  27. | :ref:`Vector3<class_Vector3>` | :ref:`collider_velocity<class_KinematicCollision_property_collider_velocity>` | ``Vector3( 0, 0, 0 )`` |
  28. +-------------------------------+-------------------------------------------------------------------------------------+------------------------+
  29. | :ref:`Object<class_Object>` | :ref:`local_shape<class_KinematicCollision_property_local_shape>` | |
  30. +-------------------------------+-------------------------------------------------------------------------------------+------------------------+
  31. | :ref:`Vector3<class_Vector3>` | :ref:`normal<class_KinematicCollision_property_normal>` | ``Vector3( 0, 0, 0 )`` |
  32. +-------------------------------+-------------------------------------------------------------------------------------+------------------------+
  33. | :ref:`Vector3<class_Vector3>` | :ref:`position<class_KinematicCollision_property_position>` | ``Vector3( 0, 0, 0 )`` |
  34. +-------------------------------+-------------------------------------------------------------------------------------+------------------------+
  35. | :ref:`Vector3<class_Vector3>` | :ref:`remainder<class_KinematicCollision_property_remainder>` | ``Vector3( 0, 0, 0 )`` |
  36. +-------------------------------+-------------------------------------------------------------------------------------+------------------------+
  37. | :ref:`Vector3<class_Vector3>` | :ref:`travel<class_KinematicCollision_property_travel>` | ``Vector3( 0, 0, 0 )`` |
  38. +-------------------------------+-------------------------------------------------------------------------------------+------------------------+
  39. Property Descriptions
  40. ---------------------
  41. .. _class_KinematicCollision_property_collider:
  42. - :ref:`Object<class_Object>` **collider**
  43. +----------+----------------+
  44. | *Getter* | get_collider() |
  45. +----------+----------------+
  46. The colliding body.
  47. ----
  48. .. _class_KinematicCollision_property_collider_id:
  49. - :ref:`int<class_int>` **collider_id**
  50. +-----------+-------------------+
  51. | *Default* | ``0`` |
  52. +-----------+-------------------+
  53. | *Getter* | get_collider_id() |
  54. +-----------+-------------------+
  55. The colliding body's unique instance ID. See :ref:`Object.get_instance_id<class_Object_method_get_instance_id>`.
  56. ----
  57. .. _class_KinematicCollision_property_collider_metadata:
  58. - :ref:`Variant<class_Variant>` **collider_metadata**
  59. +----------+-------------------------+
  60. | *Getter* | get_collider_metadata() |
  61. +----------+-------------------------+
  62. The colliding body's metadata. See :ref:`Object<class_Object>`.
  63. ----
  64. .. _class_KinematicCollision_property_collider_shape:
  65. - :ref:`Object<class_Object>` **collider_shape**
  66. +----------+----------------------+
  67. | *Getter* | get_collider_shape() |
  68. +----------+----------------------+
  69. The colliding body's shape.
  70. ----
  71. .. _class_KinematicCollision_property_collider_shape_index:
  72. - :ref:`int<class_int>` **collider_shape_index**
  73. +-----------+----------------------------+
  74. | *Default* | ``0`` |
  75. +-----------+----------------------------+
  76. | *Getter* | get_collider_shape_index() |
  77. +-----------+----------------------------+
  78. The colliding shape's index. See :ref:`CollisionObject<class_CollisionObject>`.
  79. ----
  80. .. _class_KinematicCollision_property_collider_velocity:
  81. - :ref:`Vector3<class_Vector3>` **collider_velocity**
  82. +-----------+-------------------------+
  83. | *Default* | ``Vector3( 0, 0, 0 )`` |
  84. +-----------+-------------------------+
  85. | *Getter* | get_collider_velocity() |
  86. +-----------+-------------------------+
  87. The colliding object's velocity.
  88. ----
  89. .. _class_KinematicCollision_property_local_shape:
  90. - :ref:`Object<class_Object>` **local_shape**
  91. +----------+-------------------+
  92. | *Getter* | get_local_shape() |
  93. +----------+-------------------+
  94. The moving object's colliding shape.
  95. ----
  96. .. _class_KinematicCollision_property_normal:
  97. - :ref:`Vector3<class_Vector3>` **normal**
  98. +-----------+------------------------+
  99. | *Default* | ``Vector3( 0, 0, 0 )`` |
  100. +-----------+------------------------+
  101. | *Getter* | get_normal() |
  102. +-----------+------------------------+
  103. The colliding body's shape's normal at the point of collision.
  104. ----
  105. .. _class_KinematicCollision_property_position:
  106. - :ref:`Vector3<class_Vector3>` **position**
  107. +-----------+------------------------+
  108. | *Default* | ``Vector3( 0, 0, 0 )`` |
  109. +-----------+------------------------+
  110. | *Getter* | get_position() |
  111. +-----------+------------------------+
  112. The point of collision, in global coordinates.
  113. ----
  114. .. _class_KinematicCollision_property_remainder:
  115. - :ref:`Vector3<class_Vector3>` **remainder**
  116. +-----------+------------------------+
  117. | *Default* | ``Vector3( 0, 0, 0 )`` |
  118. +-----------+------------------------+
  119. | *Getter* | get_remainder() |
  120. +-----------+------------------------+
  121. The moving object's remaining movement vector.
  122. ----
  123. .. _class_KinematicCollision_property_travel:
  124. - :ref:`Vector3<class_Vector3>` **travel**
  125. +-----------+------------------------+
  126. | *Default* | ``Vector3( 0, 0, 0 )`` |
  127. +-----------+------------------------+
  128. | *Getter* | get_travel() |
  129. +-----------+------------------------+
  130. The distance the moving object traveled before collision.
  131. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  132. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  133. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`