Class KinematicCollision2D
Holds collision data from the movement of a PhysicsBody2D.
- Inheritance
-
KinematicCollision2D
Remarks
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
get_angle(Vector2)
Qualifiers: const
Returns the collision angle according to up_direction
, which is UP by default. This value is always positive.
float get_angle(Vector2 up_direction)
Parameters
up_direction
Vector2
get_collider
Qualifiers: const
Returns the colliding body's attached Object.
Object get_collider
get_collider_id
Qualifiers: const
Returns the unique instance ID of the colliding body's attached Object. See get_instance_id.
int get_collider_id
get_collider_rid
Qualifiers: const
Returns the colliding body's RID used by the PhysicsServer2D.
RID get_collider_rid
get_collider_shape
Qualifiers: const
Returns the colliding body's shape.
Object get_collider_shape
get_collider_shape_index
Qualifiers: const
Returns the colliding body's shape index. See CollisionObject2D.
int get_collider_shape_index
get_collider_velocity
Qualifiers: const
Returns the colliding body's velocity.
Vector2 get_collider_velocity
get_depth
Qualifiers: const
Returns the colliding body's length of overlap along the collision normal.
float get_depth
get_local_shape
Qualifiers: const
Returns the moving object's colliding shape.
Object get_local_shape
get_normal
Qualifiers: const
Returns the colliding body's shape's normal at the point of collision.
Vector2 get_normal
get_position
Qualifiers: const
Returns the point of collision in global coordinates.
Vector2 get_position
get_remainder
Qualifiers: const
Returns the moving object's remaining movement vector.
Vector2 get_remainder
get_travel
Qualifiers: const
Returns the moving object's travel before collision.
Vector2 get_travel