:github_url: hide .. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the KinematicCollision2D.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_KinematicCollision2D: KinematicCollision2D ==================== **Inherits:** :ref:`Reference` **<** :ref:`Object` **Category:** Core Brief Description ----------------- Collision data for KinematicBody2D collisions. Properties ---------- +-------------------------------+---------------------------------------------------------------------------------------+ | :ref:`Object` | :ref:`collider` | +-------------------------------+---------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`collider_id` | +-------------------------------+---------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`collider_metadata` | +-------------------------------+---------------------------------------------------------------------------------------+ | :ref:`Object` | :ref:`collider_shape` | +-------------------------------+---------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`collider_shape_index` | +-------------------------------+---------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`collider_velocity` | +-------------------------------+---------------------------------------------------------------------------------------+ | :ref:`Object` | :ref:`local_shape` | +-------------------------------+---------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`normal` | +-------------------------------+---------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`position` | +-------------------------------+---------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`remainder` | +-------------------------------+---------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`travel` | +-------------------------------+---------------------------------------------------------------------------------------+ Description ----------- Contains collision data for KinematicBody2D collisions. When a :ref:`KinematicBody2D` is moved using :ref:`KinematicBody2D.move_and_collide`, it stops if it detects a collision with another body. If a collision is detected, a KinematicCollision2D object is returned. 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. Property Descriptions --------------------- .. _class_KinematicCollision2D_property_collider: - :ref:`Object` **collider** +----------+----------------+ | *Getter* | get_collider() | +----------+----------------+ The colliding body. ---- .. _class_KinematicCollision2D_property_collider_id: - :ref:`int` **collider_id** +----------+-------------------+ | *Getter* | get_collider_id() | +----------+-------------------+ The colliding body's unique :ref:`RID`. ---- .. _class_KinematicCollision2D_property_collider_metadata: - :ref:`Variant` **collider_metadata** +----------+-------------------------+ | *Getter* | get_collider_metadata() | +----------+-------------------------+ The colliding body's metadata. See :ref:`Object`. ---- .. _class_KinematicCollision2D_property_collider_shape: - :ref:`Object` **collider_shape** +----------+----------------------+ | *Getter* | get_collider_shape() | +----------+----------------------+ The colliding body's shape. ---- .. _class_KinematicCollision2D_property_collider_shape_index: - :ref:`int` **collider_shape_index** +----------+----------------------------+ | *Getter* | get_collider_shape_index() | +----------+----------------------------+ The colliding shape's index. See :ref:`CollisionObject2D`. ---- .. _class_KinematicCollision2D_property_collider_velocity: - :ref:`Vector2` **collider_velocity** +----------+-------------------------+ | *Getter* | get_collider_velocity() | +----------+-------------------------+ The colliding object's velocity. ---- .. _class_KinematicCollision2D_property_local_shape: - :ref:`Object` **local_shape** +----------+-------------------+ | *Getter* | get_local_shape() | +----------+-------------------+ The moving object's colliding shape. ---- .. _class_KinematicCollision2D_property_normal: - :ref:`Vector2` **normal** +----------+--------------+ | *Getter* | get_normal() | +----------+--------------+ The colliding body's shape's normal at the point of collision. ---- .. _class_KinematicCollision2D_property_position: - :ref:`Vector2` **position** +----------+----------------+ | *Getter* | get_position() | +----------+----------------+ The point of collision. ---- .. _class_KinematicCollision2D_property_remainder: - :ref:`Vector2` **remainder** +----------+-----------------+ | *Getter* | get_remainder() | +----------+-----------------+ The moving object's remaining movement vector. ---- .. _class_KinematicCollision2D_property_travel: - :ref:`Vector2` **travel** +----------+--------------+ | *Getter* | get_travel() | +----------+--------------+ The distance the moving object traveled before collision.