Frequent crash in bepu GetLocalExtremePointWithoutMargin()

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Danthekilla
Posts: 136
Joined: Sun Jan 17, 2010 11:35 am

Frequent crash in bepu GetLocalExtremePointWithoutMargin()

Post 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)
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Frequent crash in bepu GetLocalExtremePointWithoutMargin

Post 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.
Post Reply