Skip to content

CollisionEvent

Defined in: physics/src/types.ts:361

Collision event data passed to collision handlers.

optional contactImpulse?: number

Defined in: physics/src/types.ts:404

Magnitude of the total impulse the solver applied to resolve the contact during the step, in the same units applyImpulse takes; friction is not included. Dividing by a dynamic body’s getMass() gives the speed change that body received from the contact, in px/s (a static or kinematic body receives the event too, but no velocity change). Only on started, non-sensor collisions with a contact manifold available; may be 0 when the solver did not need to apply an impulse (e.g. a grazing contact).


optional contactImpulseVector?: Vec2

Defined in: physics/src/types.ts:412

The contact impulse as a vector, oriented from this entity toward the other like contactNormal; its length equals contactImpulse. The push on this body points the opposite way: for a dynamic body, contactImpulseVector.scale(-1 / getMass()) is its velocity change in px/s. Present exactly when contactImpulse is.


optional contactNormal?: Vec2

Defined in: physics/src/types.ts:379

Unit vector pointing from this entity toward the other, in world space, for the pair’s deepest contact. Two colliders can touch along several surfaces at once, and this is the surface pushing hardest. Only on started, non-sensor collisions; may be absent if no contact manifold is available (e.g. same-step start+stop).


optional contactPoint?: Vec2

Defined in: physics/src/types.ts:386

The world-pixel point of the pair’s deepest contact, not an average. A resting box touches at several points at once; when they are equally deep, any one of them can be reported. Only on started, non-sensor collisions; may be absent if no contact manifold is available.


other: Entity

Defined in: physics/src/types.ts:363

The other entity involved in the collision.


otherCollider: ColliderComponent

Defined in: physics/src/types.ts:365

The other entity’s collider component.


otherShapeIndex: number

Defined in: physics/src/types.ts:369

Index of the other participating shape in its collider component.


optional penetrationDepth?: number

Defined in: physics/src/types.ts:392

Penetration depth of the pair’s deepest contact in pixels, clamped to >= 0. Only on started, non-sensor collisions; may be absent if no contact manifold is available.


selfShapeIndex: number

Defined in: physics/src/types.ts:367

Index of this participating shape in its collider component.


started: boolean

Defined in: physics/src/types.ts:371

True if the collision just started, false if it ended.

Coding agents: fetch https://yage.dev/llms.txt first and prefer the Markdown references it links over these HTML pages. This page's Markdown counterpart is /llms/packages/physics.md.