PhysicsWorld.SetPreSolveFilter(Func) Method
Registers a pre-solve filter invoked by the Box2D solver for every active contact pair
each step, before collision impulses are applied. Return false to cancel the
contact for that step — no forces are applied and no collision events fire for the pair
that step, but the pair remains active and is re-evaluated next step.
Pass null to remove the filter.
public void SetPreSolveFilter(System.Func<Brine2D.Physics.PreSolveContact,bool>? filter);
Parameters¶
filter System.Func<PreSolveContact,System.Boolean>
Remarks¶
This is the correct mechanism for one-way platforms (jump-through floors). Cancel the contact when the moving body is approaching from the non-solid side by checking Normal.
The callback runs on the simulation thread inside the Box2D solver — keep it allocation-free.