I recently had a problem with my code that was helped by the addition of Validate methods to the Contact and ContactData classes.
Code: Select all
[Conditional("CHECKMATH")]
public void Validate()
{
Position.Validate();
Normal.Validate();
PenetrationDepth.Validate();
}
I had to scatter calls to Validate wherever the contact was getting set up, as well as when they were added to the various containers via AddContact (ConvexContactManifoldConstraint/NonConvexContactManifoldConstraint.AddContact). I pretty much went through all of the Bepu code wherever either of these types were configured and added a Validate call, which was around 15 spots or so.
My problem was related to custom collider type setting NaN normals and not having them detected by a Validate until much later during code invoked by BEPUphysics.Constraints.Collision.NonConvexContactManifoldConstraint.ExclusiveUpdate().
This seems to me like a useful thing to keep around, I could give you a patch if you are interested but I suspect it'd be faster/better for you to just do the same search & changes yourself if you think the extra validation is worth having.