Physics · const
EVENT_ENTER
What touched what, drained after the tick rather than raised during it.
Explained in Your first game, Rigid bodies.
const EVENT_ENTER = 0import { EVENT_ENTER } from '@driftengine/physics';In depth
Not callbacks during the solve. A callback that mutates the world mid-tick is the classic footgun — a body removed inside one invalidates every index the solver is holding — and it is also what would break the executor, since a worker solving one island cannot safely call into a consumer's code that touches another. Events accumulate into a caller-owned buffer and the caller drains them when the tick is over and the world is coherent again.
Ordered by pair key, so a replay sees them in the same order it recorded them.
Physics may not use core's MessageQueue: §2 of the design forbids importing an engine package,
and that constraint gives the right answer here anyway. A queue with backpressure is the wrong
shape for per-tick events a caller drains completely, and completely is the only way to drain
these — a dropped exit leaves a consumer believing something is still inside a trigger.