Position been set to NaN randomly

Hi,

I am hoping someone may be able to help me fix a problem we are currently having while making an iPhone game.

Basically the b2Assert(kNormal > B2_FLT_EPSILON); in the b2ContactSolver seems to be randomly failing with no overall rhyme or reason.

I tracked the cause of this failing appears to NaN values on the angle and/or position of a b2Body. The angle and/or position of any b2Body seems to be randomly set to NaN values for some obscure reason.

We have three main categories of physics bodies:
Zombies
Bullets
House walls (static objects)

I have checked when we set the bodies value that we are not setting the values to NaN and from what I can see we are not, the NaN values seem to be set within the Box2D physics engine itself. I have in fact seen the position set to NaN on the house walls, which we _never_ update the position for.

I suspect the b2Body::SynchronizeFixtures() method may be setting these values to NaN for some reason. What does this method do?

Is anyone able to shed any light on why we would see NaN values for the position of a physics object? I can post the code of the body definitions if this will help, let me know.
It is a bug in your code or in Box2D. Does this bug occur in a Debug build? If so, is the case reproducible? If so, set break points and determine where it happens.

SynchronizeFixtures updates broad-phase shape proxies to the current position of the body.
Thanks for the quick response Erin.

It was an issue with our code 😳 Division by 0 for fp calcs = bad news! Yeah when calculating the direction to move our zombies in sometimes it returend the current location leading to division by 0 leading to the linear velocity been set to (NaN, NaN).

Original thread: https://box2d.org/forum/viewtopic.php?t=4067