Let me clarify:
I control the ship's rotation using a quaternion. Each frame I pass yaw, pitch, and roll values to the ship telling it by how much it should YPR. If the ship is spinning like in the video, then only roll is not equal to 0. I need to be able to set the space suit's YPR to what the ship's is.
The problem is that I can't seem to get any useful quaternion information to apply to the space suit.....
I think I have it!!!
Here is a snippet:
ActorController.Actors[A].rotQuat=ShipController.Ship[0].RotQuat*ActorController.Actors[A].rotQuat;
//what is the angular momentum components
D3DXMATRIX tmp;
D3DXVECTOR3 rotV;
rotV.x=ShipController.Ship[0].YPRQuat.x;
rotV.y=ShipController.Ship[0].YPRQuat.y;
rotV.z=ShipController.Ship[0].YPRQuat.z;
D3DXMatrixRotationQuaternion(&tmp, &ShipController.Ship[0].RotQuat);
tmp(3,0) =0;
tmp(3,1) =0;
tmp(3,2) =0;
D3DXMatrixInverse(&tmp,0,&tmp);
D3DXVec3TransformCoord(&rotV,&rotV,&tmp);
D3DXMatrixRotationQuaternion(&tmp, &ActorController.Actors[A].rotQuat);
tmp(3,0) =0;
tmp(3,1) =0;
tmp(3,2) =0;
D3DXVec3TransformCoord(&rotV,&rotV,&tmp);
ActorController.Actors[A].Padd=rotV.x*2.0f;
ActorController.Actors[A].Yadd=rotV.y*2.0f;
ActorController.Actors[A].Radd=rotV.z*2.0f;
Basically, I stored the rotation of the ship in YPRQuat (from the current frame) and when the space suit "exits the airlock", this code happens.
It stores the YPR in a vector. Then un-rotate the vector using the ship's rotation quaternion. Then rotating the vector using the composite rotation quaternion. And finally, storing the values in the YPR floats.