Class

Collision

:

Collision resolution data.

group Physics

source

: GameObj

The first game object in the collision.

target

: GameObj

The second game object in the collision.

normal

: Vec2

The contact normal.

distance

: number

The length of the displacement.

resolved

: boolean

If the collision is resolved.

get

displacement

(): Vec2

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

reverse

() => Collision

Get a new collision with reversed source and target relationship.

hasOverlap

() => boolean

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

since v3000.0

isLeft

() => boolean

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

isRight

() => boolean

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

isTop

() => boolean

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

isBottom

() => boolean

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

preventResolution

() => void

Prevent collision resolution if not yet resolved.

since v3000.0

kaplay logo

Components