class_kinematiccollision2d.rst 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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 KinematicCollision2D.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_KinematicCollision2D:
  6. KinematicCollision2D
  7. ====================
  8. **Inherits:** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Collision data for :ref:`KinematicBody2D<class_KinematicBody2D>` collisions.
  13. Properties
  14. ----------
  15. +-------------------------------+---------------------------------------------------------------------------------------+-----------------+
  16. | :ref:`Object<class_Object>` | :ref:`collider<class_KinematicCollision2D_property_collider>` | |
  17. +-------------------------------+---------------------------------------------------------------------------------------+-----------------+
  18. | :ref:`int<class_int>` | :ref:`collider_id<class_KinematicCollision2D_property_collider_id>` | 0 |
  19. +-------------------------------+---------------------------------------------------------------------------------------+-----------------+
  20. | :ref:`Variant<class_Variant>` | :ref:`collider_metadata<class_KinematicCollision2D_property_collider_metadata>` | |
  21. +-------------------------------+---------------------------------------------------------------------------------------+-----------------+
  22. | :ref:`Object<class_Object>` | :ref:`collider_shape<class_KinematicCollision2D_property_collider_shape>` | |
  23. +-------------------------------+---------------------------------------------------------------------------------------+-----------------+
  24. | :ref:`int<class_int>` | :ref:`collider_shape_index<class_KinematicCollision2D_property_collider_shape_index>` | 0 |
  25. +-------------------------------+---------------------------------------------------------------------------------------+-----------------+
  26. | :ref:`Vector2<class_Vector2>` | :ref:`collider_velocity<class_KinematicCollision2D_property_collider_velocity>` | Vector2( 0, 0 ) |
  27. +-------------------------------+---------------------------------------------------------------------------------------+-----------------+
  28. | :ref:`Object<class_Object>` | :ref:`local_shape<class_KinematicCollision2D_property_local_shape>` | |
  29. +-------------------------------+---------------------------------------------------------------------------------------+-----------------+
  30. | :ref:`Vector2<class_Vector2>` | :ref:`normal<class_KinematicCollision2D_property_normal>` | Vector2( 0, 0 ) |
  31. +-------------------------------+---------------------------------------------------------------------------------------+-----------------+
  32. | :ref:`Vector2<class_Vector2>` | :ref:`position<class_KinematicCollision2D_property_position>` | Vector2( 0, 0 ) |
  33. +-------------------------------+---------------------------------------------------------------------------------------+-----------------+
  34. | :ref:`Vector2<class_Vector2>` | :ref:`remainder<class_KinematicCollision2D_property_remainder>` | Vector2( 0, 0 ) |
  35. +-------------------------------+---------------------------------------------------------------------------------------+-----------------+
  36. | :ref:`Vector2<class_Vector2>` | :ref:`travel<class_KinematicCollision2D_property_travel>` | Vector2( 0, 0 ) |
  37. +-------------------------------+---------------------------------------------------------------------------------------+-----------------+
  38. Description
  39. -----------
  40. Contains collision data for :ref:`KinematicBody2D<class_KinematicBody2D>` collisions. When a :ref:`KinematicBody2D<class_KinematicBody2D>` is moved using :ref:`KinematicBody2D.move_and_collide<class_KinematicBody2D_method_move_and_collide>`, it stops if it detects a collision with another body. If a collision is detected, a KinematicCollision2D object is returned.
  41. 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.
  42. Property Descriptions
  43. ---------------------
  44. .. _class_KinematicCollision2D_property_collider:
  45. - :ref:`Object<class_Object>` **collider**
  46. +----------+----------------+
  47. | *Getter* | get_collider() |
  48. +----------+----------------+
  49. The colliding body.
  50. .. _class_KinematicCollision2D_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 :ref:`RID<class_RID>`.
  58. .. _class_KinematicCollision2D_property_collider_metadata:
  59. - :ref:`Variant<class_Variant>` **collider_metadata**
  60. +----------+-------------------------+
  61. | *Getter* | get_collider_metadata() |
  62. +----------+-------------------------+
  63. The colliding body's metadata. See :ref:`Object<class_Object>`.
  64. .. _class_KinematicCollision2D_property_collider_shape:
  65. - :ref:`Object<class_Object>` **collider_shape**
  66. +----------+----------------------+
  67. | *Getter* | get_collider_shape() |
  68. +----------+----------------------+
  69. The colliding body's shape.
  70. .. _class_KinematicCollision2D_property_collider_shape_index:
  71. - :ref:`int<class_int>` **collider_shape_index**
  72. +-----------+----------------------------+
  73. | *Default* | 0 |
  74. +-----------+----------------------------+
  75. | *Getter* | get_collider_shape_index() |
  76. +-----------+----------------------------+
  77. The colliding shape's index. See :ref:`CollisionObject2D<class_CollisionObject2D>`.
  78. .. _class_KinematicCollision2D_property_collider_velocity:
  79. - :ref:`Vector2<class_Vector2>` **collider_velocity**
  80. +-----------+-------------------------+
  81. | *Default* | Vector2( 0, 0 ) |
  82. +-----------+-------------------------+
  83. | *Getter* | get_collider_velocity() |
  84. +-----------+-------------------------+
  85. The colliding object's velocity.
  86. .. _class_KinematicCollision2D_property_local_shape:
  87. - :ref:`Object<class_Object>` **local_shape**
  88. +----------+-------------------+
  89. | *Getter* | get_local_shape() |
  90. +----------+-------------------+
  91. The moving object's colliding shape.
  92. .. _class_KinematicCollision2D_property_normal:
  93. - :ref:`Vector2<class_Vector2>` **normal**
  94. +-----------+-----------------+
  95. | *Default* | Vector2( 0, 0 ) |
  96. +-----------+-----------------+
  97. | *Getter* | get_normal() |
  98. +-----------+-----------------+
  99. The colliding body's shape's normal at the point of collision.
  100. .. _class_KinematicCollision2D_property_position:
  101. - :ref:`Vector2<class_Vector2>` **position**
  102. +-----------+-----------------+
  103. | *Default* | Vector2( 0, 0 ) |
  104. +-----------+-----------------+
  105. | *Getter* | get_position() |
  106. +-----------+-----------------+
  107. The point of collision.
  108. .. _class_KinematicCollision2D_property_remainder:
  109. - :ref:`Vector2<class_Vector2>` **remainder**
  110. +-----------+-----------------+
  111. | *Default* | Vector2( 0, 0 ) |
  112. +-----------+-----------------+
  113. | *Getter* | get_remainder() |
  114. +-----------+-----------------+
  115. The moving object's remaining movement vector.
  116. .. _class_KinematicCollision2D_property_travel:
  117. - :ref:`Vector2<class_Vector2>` **travel**
  118. +-----------+-----------------+
  119. | *Default* | Vector2( 0, 0 ) |
  120. +-----------+-----------------+
  121. | *Getter* | get_travel() |
  122. +-----------+-----------------+
  123. The distance the moving object traveled before collision.