Updating to v1.2 help
Posted: Thu Jun 07, 2012 11:33 am
I recently tried to update from v0.16 to v1.2 and have run into a couple issues I can't figure out.
One object I made is a directional force field that allows players to move through one way but not the other, like a jump through platform. In 0.16 I checked what side of the field a player was on in the CreatingContact event and then if the player was on the one side I set the pair's CollisionRule to NoNarrowPhaseUpdate and it did what I wanted. When I updated to 1.2 that bit of code stopped working as expected. I can see that it changes the collision rule, it just seems to be getting changed back at some point.
I tried moving the position check to the PairTouching event and that seems to work like before. However, that leads into my second issue, it occasionally crashes when a player moves through the field with an ArithmeticException Function does not accept floating point Not-a-Number values.
The stack trace points to:
at System.Math.Sign(Single value)
at BEPUphysics.CollisionShapes.ConvexShapes.BoxShape.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.GJK.GJKToolbox.AreShapesIntersecting(ConvexShape shapeA, ConvexShape shapeB, RigidTransform& transformA, RigidTransform& transformB, Vector3& localSeparatingAxis)
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.Threading.ParallelLoopWorker.Work()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
That same error did come up sometimes in 0.16, but I didn't know what was causing it before. I'm still not entirely sure because it’s pretty rare, although it seems to happen more often in 1.2. It seems to happen more when a player is walking through as oppose to dashing but I really have no idea what’s causing that one.
So anyway, is there something happening after CreatingContact that would reset the CollisionRule and is there anything I can do to avoid that error?
Any help would be appreciated!
One object I made is a directional force field that allows players to move through one way but not the other, like a jump through platform. In 0.16 I checked what side of the field a player was on in the CreatingContact event and then if the player was on the one side I set the pair's CollisionRule to NoNarrowPhaseUpdate and it did what I wanted. When I updated to 1.2 that bit of code stopped working as expected. I can see that it changes the collision rule, it just seems to be getting changed back at some point.
I tried moving the position check to the PairTouching event and that seems to work like before. However, that leads into my second issue, it occasionally crashes when a player moves through the field with an ArithmeticException Function does not accept floating point Not-a-Number values.
The stack trace points to:
at System.Math.Sign(Single value)
at BEPUphysics.CollisionShapes.ConvexShapes.BoxShape.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.GJK.GJKToolbox.AreShapesIntersecting(ConvexShape shapeA, ConvexShape shapeB, RigidTransform& transformA, RigidTransform& transformB, Vector3& localSeparatingAxis)
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.Threading.ParallelLoopWorker.Work()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
That same error did come up sometimes in 0.16, but I didn't know what was causing it before. I'm still not entirely sure because it’s pretty rare, although it seems to happen more often in 1.2. It seems to happen more when a player is walking through as oppose to dashing but I really have no idea what’s causing that one.
So anyway, is there something happening after CreatingContact that would reset the CollisionRule and is there anything I can do to avoid that error?
Any help would be appreciated!