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