Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

KinematicCollision2D

Inherits: RefCounted < Object

Holds collision data from the movement of a PhysicsBody2D.

Description

Holds collision data from the movement of a PhysicsBody2D, usually from PhysicsBody2D.move_and_collide. When a PhysicsBody2D is moved, it stops if it detects a collision with another body. If a collision is detected, a KinematicCollision2D object is returned.

The collision data includes the colliding object, the remaining motion, and the collision position. This data can be used to determine a custom response to the collision.

Methods

float

get_angle ( Vector2 up_direction=Vector2(0, -1) ) const

Object

get_collider ( ) const

int

get_collider_id ( ) const

RID

get_collider_rid ( ) const

Object

get_collider_shape ( ) const

int

get_collider_shape_index ( ) const

Vector2

get_collider_velocity ( ) const

float

get_depth ( ) const

Object

get_local_shape ( ) const

Vector2

get_normal ( ) const

Vector2