Collision data for KinematicBody2D collisions.
    public class KinematicCollision2D : Reference

Contains collision data for KinematicBody2D collisions. When a KinematicBody2D is moved using KinematicBody2D.MoveAndCollide(Godot.Vector2, bool, bool, bool), 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.

Inheritance Chain

Constructors

    public KinematicCollision2D()

Properties

    public Object Collider { get; }

The colliding body.

    public int ColliderId { get; }

The colliding body’s unique RID.

    public object ColliderMetadata { get; }

The colliding body’s metadata. See Object.

    public Object ColliderShape { get; }

The colliding body’s shape.

    public int ColliderShapeIndex { get; }

The colliding shape’s index. See CollisionObject2D.

    public Vector2 ColliderVelocity { get; }

The colliding object’s velocity.

    public Object LocalShape { get; }

The moving object’s colliding shape.

    public Vector2 Normal { get; }

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

    public Vector2 Position { get; }

The point of collision.

    public Vector2 Remainder { get; }

The moving object’s remaining movement vector.

    public Vector2 Travel { get; }

The distance the moving object traveled before collision.

Methods

    public Object GetCollider()

Getter for Collider

    public int GetColliderId()

Getter for ColliderId

    public object GetColliderMetadata()

Getter for ColliderMetadata

    public Object GetColliderShape()

Getter for ColliderShape

    public int GetColliderShapeIndex()

Getter for ColliderShapeIndex

    public Vector2 GetColliderVelocity()

Getter for ColliderVelocity

    public Object GetLocalShape()

Getter for LocalShape

    public Vector2 GetNormal()

Getter for Normal

    public Vector2 GetPosition()

Getter for Position

    public Vector2 GetRemainder()

Getter for Remainder

    public Vector2 GetTravel()

Getter for Travel

Tags: