arcade2d
Interface

CollisionEvent

physics/rigid-body.types.ts:145

A single collision delivered to a RigidBody's RigidBodyOptions.onCollisionStart or RigidBodyOptions.onCollisionEnd listener: a description of who touched (or stopped touching) the listening body this frame.

The event is fired from the listening body's point of view, so CollisionEvent.self is always the body whose listener is running and CollisionEvent.other is its counterpart. Use the event to react to contact — deal damage, play a hit sound, despawn a projectile — by reading the other body's host WorldObject and its components.

Lifetime and timing

The event object is short-lived: it is constructed for the dispatch and not retained by the engine, so it is safe to read synchronously but should not be stashed for a later frame (capture the values you need instead). Listeners run during the listening body's update phase, after the simulation has stepped and transforms have been read back, so both hosts' positions are the settled post-step values for the frame.

Either party may already be marked for destruction by the time your listener runs (another object's update earlier in the same frame may have called WorldObject.destroy). The object is still live — its teardown is deferred to the end of the tick — but check WorldObject.destroyed before acting on it if your reaction depends on it surviving.

Properties

readonly #
other: RigidBody

The other body involved in the contact.

readonly #
otherObject: WorldObject

Convenience accessor for other.host — the WorldObject the other body is attached to, the usual entry point for reading its tags and components.

readonly #
self: RigidBody

The body whose listener is running — i.e. the one the RigidBodyOptions.onCollisionStart / RigidBodyOptions.onCollisionEnd callback belongs to.

ESC