I'm looking at what's available in BEPU and I can't see any easy way to detect when a collision is about to occur and then using some callback and checking information in the entities tag, decide if the collision should have a response or not.
Is there a good way to do this?
Deciding Collision Response per Object
Re: Deciding Collision Response per Object
The most direct way is to use the existing collision rules system. An example of its usage can be found in the CollisionFilteringDemo in the BEPUphysicsDemos source.
If the Group/Personal/Specific setup is not expressive enough to produce the desired collision rules, the CollisionRules.CollisionRuleCalculator callback can be changed to anything you want. Its parameters are two ICollisionRulesOwners; you can use these to get at the reference to your entity tag by trying to cast the ICollisionRulesOwner to an EntityCollidable and using its Entity property if the cast succeeds.
The collision rule computed by the CollisionRuleCalculator is available in every NarrowPhasePair's CollisionRule property. If you hook one of the collision events (entity.CollisionInformation.Events), you can override the collision rule determined by the CollisionRuleCalculator. Doing it this way can be a little trickier because you must be aware of the relative execution timing between various events and stages. For example, the event used should be an immediate event which occurs before solving in the first frame, or else it won't take effect in time. DetectingInitialCollision would be appropriate. More information about events can be found in the documentation.
If the Group/Personal/Specific setup is not expressive enough to produce the desired collision rules, the CollisionRules.CollisionRuleCalculator callback can be changed to anything you want. Its parameters are two ICollisionRulesOwners; you can use these to get at the reference to your entity tag by trying to cast the ICollisionRulesOwner to an EntityCollidable and using its Entity property if the cast succeeds.
The collision rule computed by the CollisionRuleCalculator is available in every NarrowPhasePair's CollisionRule property. If you hook one of the collision events (entity.CollisionInformation.Events), you can override the collision rule determined by the CollisionRuleCalculator. Doing it this way can be a little trickier because you must be aware of the relative execution timing between various events and stages. For example, the event used should be an immediate event which occurs before solving in the first frame, or else it won't take effect in time. DetectingInitialCollision would be appropriate. More information about events can be found in the documentation.