[ODE] Body Position becoming #QNAN

Gopi Prashanth gprashanth at Heavy-Iron.com
Thu Apr 7 14:30:06 MST 2005

Actually, I'm having kind of a similar problem. I have successfully added
continuous collision to ODE and it works great. To do that I have to
basically do a predictive time stepping method.. so my stepWorld loop looks
like this...

- Get the first time of impact with any object in scene.
- simulate slightly past that time ( to cause penetration )
- resolve collision
- simulate enough so that the penetrations are resolved.
- go back to step one...

This works wonders and I can shoot an object at any speed and be rest
assured it will never exit the world. 
The problem is similar, if I simulate this for some cases... (reproduceable)
but I cannot pin point when.. the body pos goes to Qnans

I'm trying to debug this. I feel this has to do with me sending the
quickstepper function a very small dt and then the quickstepper trying to
iterate and further subdivide this dt.. any info along these lines would be
greatly appreciated...


-----Original Message-----
From: Vincent Mysliwiec [mailto:vincent_mysliwiec at hotmail.com]
Sent: Thursday, April 07, 2005 12:22 PM
To: ode at q12.org
Subject: [ODE] Body Position becoming #QNAN

I'm making a ball racing game and am experiencing some reproducible
weirdness. However, I cannot solve the bug. The player controls a sphere
marble with a sphere body and on some places within a trimesh collision the
body's position goes to QNAN - not a number. I'm using single precision
floating point resolution. And here's a code snippet where I get/update the
mesh body position based on the ODE::body position

void UpdateRigidBody(...)    // called once every frame



Vector3D* theBodyPosPtr = (Vector3D*)dBodyGetPosition(theBodyID);

memcpy(&theBodyPosition, theBodyPosPtr, sizeof(Vector3D));

float theNANFloat = std::numeric_limits<float>::quiet_NaN();

if (memcmp(&theBodyPosition.x, &theNANFloat, sizeof(float)) == 0)


if (memcmp(&theBodyPosition.y, &theNANFloat, sizeof(float)) == 0)


if (memcmp(&theBodyPosition.z, &theNANFloat, sizeof(float)) == 0)




Some obvious questions include:

(a) has anybody else seen this before? (b) am i getting position correctly?

Any help is appreciated!


More information about the ODE mailing list