KinematicCollision2D

Inherits: Reference < Object

Category: Core

Brief Description

Collision data for KinematicBody2D collisions.

Properties

Objectcollider
intcollider_id
Variantcollider_metadata
Objectcollider_shape
intcollider_shape_index
Vector2collider_velocity
Objectlocal_shape
Vector2normal
Vector2position
Vector2remainder
Vector2travel

Description

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

Property Descriptions

Getterget_collider()

The colliding body.


  • int collider_id
Getterget_collider_id()

The colliding body’s unique RID.


Getterget_collider_metadata()

The colliding body’s metadata. See Object.


Getterget_collider_shape()

The colliding body’s shape.


  • int collider_shape_index
Getterget_collider_shape_index()

The colliding shape’s index. See CollisionObject2D.


Getterget_collider_velocity()

The colliding object’s velocity.


Getterget_local_shape()

The moving object’s colliding shape.


Getterget_normal()

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


Getterget_position()

The point of collision.


Getterget_remainder()

The moving object’s remaining movement vector.


Getterget_travel()

The distance the moving object traveled before collision.