W3cubDocs

/Godot 3.2

KinematicCollision

Inherits: Reference < Object

Collision data for KinematicBody collisions.

Description

Contains collision data for KinematicBody collisions. When a KinematicBody is moved using KinematicBody.move_and_collide, it stops if it detects a collision with another body. If a collision is detected, a KinematicCollision 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.

Properties

Object collider
int collider_id 0
Variant collider_metadata
Object collider_shape
int collider_shape_index 0
Vector3 collider_velocity Vector3( 0, 0, 0 )
Object local_shape
Vector3 normal Vector3( 0, 0, 0 )
Vector3 position Vector3( 0, 0, 0 )
Vector3 remainder Vector3( 0, 0, 0 )
Vector3 travel Vector3( 0, 0, 0 )

Property Descriptions

Object collider

Getter get_collider()

The colliding body.

int collider_id

Default 0
Getter get_collider_id()

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

Variant collider_metadata

Getter get_collider_metadata()

The colliding body's metadata. See Object.

Object collider_shape

Getter get_collider_shape()

The colliding body's shape.

int collider_shape_index

Default 0
Getter get_collider_shape_index()

The colliding shape's index. See CollisionObject.

Vector3 collider_velocity

Default Vector3( 0, 0, 0 )
Getter get_collider_velocity()

The colliding object's velocity.

Object local_shape

Getter get_local_shape()

The moving object's colliding shape.

Vector3 normal

Default Vector3( 0, 0, 0 )
Getter get_normal()

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

Vector3 position

Default Vector3( 0, 0, 0 )
Getter get_position()

The point of collision, in global coordinates.

Vector3 remainder

Default Vector3( 0, 0, 0 )
Getter get_remainder()

The moving object's remaining movement vector.

Vector3 travel

Default Vector3( 0, 0, 0 )
Getter get_travel()

The distance the moving object traveled before collision.

© 2014–2020 Juan Linietsky, Ariel Manzur, Godot Engine contributors
Licensed under the MIT License.
https://docs.godotengine.org/en/3.2/classes/class_kinematiccollision.html