Original Post
Update : I've solved the first problem - I was normalising the vectors that made up the rotation matrix a tad too early... go figure! However, I still have the issue of the angle not going over 180! I use this to extract the angle from the matrix: and this to calculate the required forces: The player can now move perfectly well up and down the screen, but not to the left - the angle seems to be constrained within 0 - 180. I've checked the value of trace and that starts at 3 (0 degrees) and goes to -1 (180 degrees) but again doesn't go any further. I assume it's something with the extraction of the angle from the matrix, but I'm not sure how I might fix it! if anyone has any ideas, I'd be most thankful to hear them! [Edited by - Ging on March 18, 2005 11:27:20 AM]
float CPlayer::getOrientation()
{
float trace = pBody.orientation.RotX.x + pBody.orientation.RotY.y + pBody.orientation.RotZ.z;
float fcos = 0.5*(trace-1.0);
float angle = acos(fcos);
return angle;
}
angle = player.getOrientation();
angledeg = angle * RTOD;
xforce = sin(angle) * 0.05;
yforce = cos(angle) * 0.05;