Table of Contents

Interface INarrowPhaseFilter

Namespace
Jitter2.Collision
Assembly
Jitter2.dll

Provides a hook into the narrowphase collision detection pipeline.

public interface INarrowPhaseFilter

Remarks

Implement this interface to intercept collisions after contact generation. This can be used to modify contact data, implement custom collision responses, or filter out specific collisions.

Methods

Filter(RigidBodyShape, RigidBodyShape, ref JVector, ref JVector, ref JVector, ref float)

Called for each detected collision with its contact data.

[CallbackThread(ThreadContext.Any)]
bool Filter(RigidBodyShape shapeA, RigidBodyShape shapeB, ref JVector pointA, ref JVector pointB, ref JVector normal, ref float penetration)

Parameters

shapeA RigidBodyShape

The first shape in the collision.

shapeB RigidBodyShape

The second shape in the collision.

pointA JVector

Contact point on shape A (modifiable).

pointB JVector

Contact point on shape B (modifiable).

normal JVector

Collision normal used to solve the contact (modifiable). A positive normal impulse pushes shape B along this direction and shape A against it.

penetration float

Signed penetration depth reported by the narrowphase. Changes to this value alone do not affect the registered contact; its separation is derived from the contact points and normal.

Returns

bool

true to keep the collision; false to discard it.