Page 1 of 1

Frequent crash in bepu GetLocalExtremePointWithoutMargin()

Posted: Sun Jun 17, 2012 4:34 am
by Danthekilla
Hey Norbo (and everyone else) I am having some issues with bepu (most likely my fault as per normal).

In the build of our game we have up on the marketplace we are getting 20-30 crashes a day with an exception like below.
What could cause this exception to happen? And how would you suggest we find/fix it?

-------------------------------------------------------------------------------------------------------------
ArithmeticException

at System.Math.Sign(Single value)
at BEPUphysics.CollisionShapes.ConvexShapes.CylinderShape.GetLocalExtremePointWithoutMargin(Vector3& direction, Vector3& extremePoint)
at BEPUphysics.CollisionTests.CollisionAlgorithms.MinkowskiToolbox.GetLocalMinkowskiExtremePoint(ConvexShape shapeA, ConvexShape shapeB, Vector3& direction, RigidTransform& localTransformB, Vector3& extremePoint)
at BEPUphysics.CollisionTests.CollisionAlgorithms.MPRToolbox.AreLocalShapesOverlapping(ConvexShape shapeA, ConvexShape shapeB, Vector3& originRay, RigidTransform& localTransformB)
at BEPUphysics.CollisionTests.CollisionAlgorithms.MPRToolbox.AreLocalShapesOverlapping(ConvexShape shapeA, ConvexShape shapeB, RigidTransform& localTransformB)
at BEPUphysics.CollisionTests.CollisionAlgorithms.MPRToolbox.GetContact(ConvexShape shapeA, ConvexShape shapeB, RigidTransform& transformA, RigidTransform& transformB, Vector3& penetrationAxis, ContactData& contact)
at BEPUphysics.CollisionTests.CollisionAlgorithms.GeneralConvexPairTester.DoDeepContact(ContactData& contact)
at BEPUphysics.CollisionTests.CollisionAlgorithms.GeneralConvexPairTester.GenerateContactCandidate(ContactData& contact)
at BEPUphysics.CollisionTests.Manifolds.GeneralConvexContactManifold.Update(Single dt)
at BEPUphysics.NarrowPhaseSystems.Pairs.StandardPairHandler.UpdateCollision(Single dt)
at BEPUphysics.NarrowPhaseSystems.NarrowPhase.UpdateBroadPhaseOverlap(Int32 i)
at BEPUphysics.NarrowPhaseSystems.NarrowPhase.UpdateSingleThreaded()
at BEPUphysics.MultithreadedProcessingStage.Update()
at BEPUphysics.Space.DoTimeStep()
at BEPUphysics.Space.Update(Single dt)

Re: Frequent crash in bepu GetLocalExtremePointWithoutMargin

Posted: Sun Jun 17, 2012 4:59 am
by Norbo
Stuff like that usually happens when there's a propagating NaN/infinity infection. In v1.2.0, there's a helper system which could catch the problem sooner: compile the library with the CHECKMATH compilation symbol defined. Most interaction points and stages will then analyze their data for invalid values. If it doesn't catch the infection earlier, start strategically sprinkling more MathChecker validation tests all over the place. Something should be able to detect a problem sooner than that exception.

Some common causes include invalid values set on some property (position/orientation/velocity usually), unprotected normalization of possibly zero length vectors, corrupting asynchronous accesses, invalid collision geometry, or exceptionally bad numerical conditions.