Interface INarrowPhaseCallbacks
- Namespace
- BepuPhysics.CollisionDetection
- Assembly
- BepuPhysics.dll
Defines handlers for narrow phase events.
public interface INarrowPhaseCallbacks
Methods
AllowContactGeneration(int, CollidableReference, CollidableReference, ref float)
Chooses whether to allow contact generation to proceed for two overlapping collidables.
bool AllowContactGeneration(int workerIndex, CollidableReference a, CollidableReference b, ref float speculativeMargin)
Parameters
workerIndexintIndex of the worker that identified the overlap.
aCollidableReferenceReference to the first collidable in the pair.
bCollidableReferenceReference to the second collidable in the pair.
speculativeMarginfloatReference to the speculative margin used by the pair. The value was already initialized by the narrowphase by examining the speculative margins of the involved collidables, but it can be modified.
Returns
- bool
True if collision detection should proceed, false otherwise.
AllowContactGeneration(int, CollidablePair, int, int)
Chooses whether to allow contact generation to proceed for the children of two overlapping collidables in a compound-including pair.
bool AllowContactGeneration(int workerIndex, CollidablePair pair, int childIndexA, int childIndexB)
Parameters
workerIndexintIndex of the worker thread processing this pair.
pairCollidablePairParent pair of the two child collidables.
childIndexAintIndex of the child of collidable A in the pair. If collidable A is not compound, then this is always 0.
childIndexBintIndex of the child of collidable B in the pair. If collidable B is not compound, then this is always 0.
Returns
- bool
True if collision detection should proceed, false otherwise.
Remarks
This is called for each sub-overlap in a collidable pair involving compound collidables. If neither collidable in a pair is compound, this will not be called. For compound-including pairs, if the earlier call to AllowContactGeneration returns false for owning pair, this will not be called. Note that it is possible for this function to be called twice for the same subpair if the pair has continuous collision detection enabled; the CCD sweep test that runs before the contact generation test also asks before performing child pair tests.
ConfigureContactManifold(int, CollidablePair, int, int, ref ConvexContactManifold)
Provides a notification that a manifold has been created between the children of two collidables in a compound-including pair. Offers an opportunity to change the manifold's details.
bool ConfigureContactManifold(int workerIndex, CollidablePair pair, int childIndexA, int childIndexB, ref ConvexContactManifold manifold)
Parameters
workerIndexintIndex of the worker thread that created this manifold.
pairCollidablePairPair of collidables that the manifold was detected between.
childIndexAintIndex of the child of collidable A in the pair. If collidable A is not compound, then this is always 0.
childIndexBintIndex of the child of collidable B in the pair. If collidable B is not compound, then this is always 0.
manifoldConvexContactManifoldSet of contacts detected between the collidables.
Returns
- bool
True if this manifold should be considered for the parent pair's contact manifold generation, false otherwise.
ConfigureContactManifold<TManifold>(int, CollidablePair, ref TManifold, out PairMaterialProperties)
Provides a notification that a manifold has been created for a pair. Offers an opportunity to change the manifold's details.
bool ConfigureContactManifold<TManifold>(int workerIndex, CollidablePair pair, ref TManifold manifold, out PairMaterialProperties pairMaterial) where TManifold : unmanaged, IContactManifold<TManifold>
Parameters
workerIndexintIndex of the worker thread that created this manifold.
pairCollidablePairPair of collidables that the manifold was detected between.
manifoldTManifoldSet of contacts detected between the collidables.
pairMaterialPairMaterialPropertiesMaterial properties of the manifold.
Returns
- bool
True if a constraint should be created for the manifold, false otherwise.
Type Parameters
TManifold
Dispose()
Releases any resources held by the callbacks. Called by the owning narrow phase when it is being disposed.
void Dispose()
Initialize(Simulation)
Performs any required initialization logic after the Simulation instance has been constructed.
void Initialize(Simulation simulation)
Parameters
simulationSimulationSimulation that owns these callbacks.