View Full Version : Getting overhead rotation angle from matrix?

03-16-2013, 01:21 PM

I have what I believe to be a typical OpenGL camera setup. I need to figure out the rotation angle of the camera around the Y axis. I have been doing this by getting the Euler angles from my camera rotation matrix (in YXZ order) and then using that Y as the value. It seems to work when the camera is low to the ground, but the more vertical the camera becomes, the angle seems off.

Basically I guess I could also do this by getting the XYZ camera position and projecting the vector from the origin to there onto the flat ZY plane. That would basically give me the angle, as if the ground plane were a clock face and that vector one of the hands.

Is that the best and/or easiest way to do it? How would I actually do that?


03-22-2013, 07:21 AM
nobody knows?

06-03-2013, 08:34 AM
Still want to know how to do this! Anyone?

06-04-2013, 12:09 AM
Project the points (0,0,0) and (0,0,-1) by the inverse of the model-view matrix, and subtract the results.