CollisionEvent
Defined in: physics/src/types.ts:261
Collision event data passed to collision handlers.
Properties
Section titled “Properties”contactImpulse?
Section titled “contactImpulse?”
optionalcontactImpulse?:number
Defined in: physics/src/types.ts:300
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).
contactImpulseVector?
Section titled “contactImpulseVector?”
optionalcontactImpulseVector?:Vec2
Defined in: physics/src/types.ts:308
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.
contactNormal?
Section titled “contactNormal?”
optionalcontactNormal?:Vec2
Defined in: physics/src/types.ts:275
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).
contactPoint?
Section titled “contactPoint?”
optionalcontactPoint?:Vec2
Defined in: physics/src/types.ts:282
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:263
The other entity involved in the collision.
otherCollider
Section titled “otherCollider”otherCollider:
ColliderComponent
Defined in: physics/src/types.ts:265
The other entity’s collider component.
penetrationDepth?
Section titled “penetrationDepth?”
optionalpenetrationDepth?:number
Defined in: physics/src/types.ts:288
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.
started
Section titled “started”started:
boolean
Defined in: physics/src/types.ts:267
True if the collision just started, false if it ended.