KinematicCollision2D

    Collision data for collisions.

    Contains collision data for KinematicBody2D collisions. When a is moved using 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.

    • collider
    Getterget_collider()

    The colliding body.


    Default0
    Getterget_collider_id()

    Getterget_collider_metadata()

    The colliding body’s metadata. See .


    The colliding body’s shape.


    • collider_shape_index
    Default
    Getterget_collider_shape_index()

    The colliding shape’s index. See CollisionObject2D.


    • collider_velocity
    DefaultVector2( 0, 0 )
    Getterget_collider_velocity()

    The colliding object’s velocity.


    Getterget_local_shape()

    The colliding body’s shape’s normal at the point of collision.


    • position
    DefaultVector2( 0, 0 )
    Getterget_position()

    The point of collision, in global coordinates.


    Default
    Getterget_remainder()

    The moving object’s remaining movement vector.


    • travel
    DefaultVector2( 0, 0 )
    Getterget_travel()

    The distance the moving object traveled before collision.