getWorldTransform returns NAN in Debug mode
Posted: Wed May 09, 2018 12:40 pm
Hi
When running my program in normal mode - everything works fine - I can control my camera, and world collision is spot on.
When running in Debug mode the same code generates a NAN for each element below:
This causes an assertion failure in GLM as it is passed an invalid value to work with. 'tempPosition' above , when in Debug mode contains three NAN's.
I am using the latest compile version from Github ( as of yesterday ).
My camera starts off with the correct position in Release mode. It starts above the map floor, and gravity brings it down to land on the plane. Collision detection then keeps it on that plane - but only in Release mode.
My main loop looks like this:
Any advice on how to fix this?
Thanks
When running my program in normal mode - everything works fine - I can control my camera, and world collision is spot on.
When running in Debug mode the same code generates a NAN for each element below:
Code: Select all
//------------------------------------------------------------
//
// Return position of the camera after physics world processed
glm::vec3 bul_returnCameraPosition()
//------------------------------------------------------------
{
glm::vec3 tempPosition;
btTransform trans;
playerRigidBody->getMotionState()->getWorldTransform ( trans );
tempPosition.x = trans.getOrigin().getX();
tempPosition.y = trans.getOrigin().getY();
tempPosition.z = trans.getOrigin().getZ();
return tempPosition;
}
I am using the latest compile version from Github ( as of yesterday ).
My camera starts off with the correct position in Release mode. It starts above the map floor, and gravity brings it down to land on the plane. Collision detection then keeps it on that plane - but only in Release mode.
My main loop looks like this:
Code: Select all
// Return the direction vector and turn this into velocity for physics
bul_setCameraVelocity(cam3_getVelocity());
bul_processPhysics ( 60.0f );
vel = bul_returnCameraPosition(); // this contains NAN in Debug mode
cam3_Position = vel;
cam3_CreateViewMatrix(cam3_Position); // causing an error in GLM due to bad values
Thanks