The kind of interaction to intercept (COLLISION, SENSOR, FLUID, or ANY).
Filter for the first interactor, or null to match any.
Filter for the second interactor, or null to match any.
Called each step; return a PreFlag to control the interaction.
Execution order relative to other listeners (higher = first). Default 0.
Enable caching of the handler result. Default false.
The handler called before each collision resolution step.
Return a PreFlag to accept/ignore the interaction, or null to accept.
The type of interaction this pre-listener intercepts (COLLISION, SENSOR, FLUID, or ANY).
Filter for the first interactor. Order does not matter.
Filter for the second interactor. Order does not matter.
When true, the engine caches the handler return value and does not
re-invoke the handler until the cached result is invalidated.
Only use pure mode when the handler always returns the same flag for a
given pair of interactors. Setting pure to false immediately invalidates
any cached result.
The type of this listener (BODY, CONSTRAINT, INTERACTION, or PRE).
Pre-interaction listener — called before collision resolution each step.
The handler receives a PreCallback and returns a PreFlag that determines whether and how the interaction should be processed:
PreFlag.ACCEPT— resolve the interaction normally (default).PreFlag.IGNORE— suppress the interaction permanently (until nextBEGIN).PreFlag.ACCEPT_ONCE— accept this step, then revert to default.PreFlag.IGNORE_ONCE— ignore this step only.Returning
nullis equivalent toACCEPT.The event is always CbEvent.PRE and cannot be changed.
Pure mode: when
pureistruethe engine caches the handler result and does not re-invoke it until the result is reset. This is an optimisation — only usepurewhen the handler will always return the same flag for a given pair.Example
Fully modernized from nape-compiled.js lines 1142–1338.