Collision:

Collision resolution data.

source: GameObj

The first game object in the collision.

target: GameObj

The second game object in the collision.

normal: Vec2

The contact normal.

distance: Vec2

The length of the displacement.

displacement: Vec2

The displacement source game object have to make to avoid the collision.

resolved: boolean

If the collision is resolved.

preventResolution(): void

Prevent collision resolution if not yet resolved.

sincev3000.0

hasOverlap(): boolean

If the 2 objects have any overlap, or they're just touching edges.

sincev3000.0

reverse(): Collision

Get a new collision with reversed source and target relationship.

isTop(): boolean

If the collision happened (roughly) on the top side.

isBottom(): boolean

If the collision happened (roughly) on the bottom side.

isLeft(): boolean

If the collision happened (roughly) on the left side.

isRight(): boolean

If the collision happened (roughly) on the right side.
kaplay logo