Getting overhead rotation angle from matrix?


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?


nobody knows?

Still want to know how to do this! Anyone?

Project the points (0,0,0) and (0,0,-1) by the inverse of the model-view matrix, and subtract the results.