KinematicCollision2D

Inherits: Reference < Object

Collision data for KinematicBody2D collisions.

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
Default0
Getterget_collider_id()

The colliding body’s unique instance ID. See Object.get_instance_id.


Getterget_collider_metadata()

The colliding body’s metadata. See Object.


Getterget_collider_shape()

The colliding body’s shape.


  • int collider_shape_index
Default0
Getterget_collider_shape_index()

The colliding shape’s index. See CollisionObject2D.


DefaultVector2( 0, 0 )
Getterget_collider_velocity()

The colliding object’s velocity.


Getterget_local_shape()

The moving object’s colliding shape.


DefaultVector2( 0, 0 )
Getterget_normal()

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


DefaultVector2( 0, 0 )
Getterget_position()

The point of collision, in global coordinates.


DefaultVector2( 0, 0 )
Getterget_remainder()

The moving object’s remaining movement vector.


DefaultVector2( 0, 0 )
Getterget_travel()

The distance the moving object traveled before collision.

Doc ID missing

Disclaimer: This page has been automaticaly and directly extracted from the official Godot Docs website, the 1970-01-01 at 00:00:00. It’s the English Stable version because it’s what most Godot users should use. The Copyright owners are Juan Linietsky, Ariel Manzur and the Godot community. CC-BY 3.0. Thanks for your patience and generosity.