Struct KinematicCollision2D
Collision data for KinematicBody2D collisions.
struct KinematicCollision2D
;
Contains collision data for KinematicBody2D collisions. When a KinematicBody2D is moved using KinematicBody2D, 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.
Properties
| Name | Type | Description |
|---|---|---|
collider[get]
|
GodotObject | The colliding body. |
colliderId[get]
|
long | The colliding body's unique instance ID. See GodotObject.
|
colliderMetadata[get]
|
Variant | The colliding body's metadata. See GodotObject.
|
colliderShape[get]
|
GodotObject | The colliding body's shape. |
colliderShapeIndex[get]
|
long | The colliding shape's index. See CollisionObject2D.
|
colliderVelocity[get]
|
Vector2 | The colliding object's velocity. |
localShape[get]
|
GodotObject | The moving object's colliding shape. |
normal[get]
|
Vector2 | The colliding body's shape's normal at the point of collision. |
position[get]
|
Vector2 | The point of collision, in global coordinates. |
remainder[get]
|
Vector2 | The moving object's remaining movement vector. |
travel[get]
|
Vector2 | The distance the moving object traveled before collision. |
Methods
| Name | Description |
|---|---|
getCollider
|
|
getColliderId
|
|
getColliderMetadata
|
|
getColliderShape
|
|
getColliderShapeIndex
|
|
getColliderVelocity
|
|
getLocalShape
|
|
getNormal
|
|
getPosition
|
|
getRemainder
|
|
getTravel
|