Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public interface ContactFilter
Decides, step by step, whether two touching bodies in a PhysicsWorld push
on each other. Install with PhysicsWorld#setContactFilter(ContactFilter).
Returning false lets the bodies pass through each other for this step only;
the question is asked again on the next step while they still overlap. That
is how one-way platforms, team pass-through and “ghost” pickups are made –
PhysicsWorld#setOneWay(PhysicsBody, boolean) is the stock one-way rule.
Called from inside PhysicsWorld#step(float). Do not create or destroy
bodies here.
Methods
public abstract boolean shouldCollide(PhysicsBody a, PhysicsBody b, float normalX, float normalY) | Whether two bodies collide this step. |
Method details
shouldCollide
public abstract boolean shouldCollide(PhysicsBody a, PhysicsBody b, float normalX, float normalY)Whether two bodies collide this step.
Parameters
aPhysicsBody- one body
bPhysicsBody- the other
normalXfloat- the contact normal from
atob, screen space normalYfloat- the contact normal from
atob, screen space (positive is down)
Returns
false to let them pass through each other this step