I am trying to get the rotation/origin of my btRigidBodies in order to save game state.
Code: Select all
btTransform transform;
sBoxBodies[i]->getMotionState()->getWorldTransform(transform);
btScalar yaw, pitch, roll;
btMatrix3x3 mat = btMatrix3x3(transform.getRotation());
mat.getEulerYPR(yaw, pitch, roll);
NSLog(@"cube %d origin:%f,%f,%f rotation:%f,%f,%f", i, transform.getOrigin().getX(),transform.getOrigin().getY(),transform.getOrigin().getZ(),yaw,pitch,roll);
cube 4 origin:3.762772,-6.667145,5.960001 rotation:-1.631328,nan,-1.025141
Does anyone else get this? Is there a better way to store the details of a quaternion?
Thanks,
Conor