PDA

View Full Version : Finding pitch and yaw angles



shoke
11-11-2010, 02:21 PM
I have a (hopefully) simple questions. I'm trying to get the pitch and yaw angles for a camera from the (x,y) mouse position so I can update my LookAt vector (for gluLookAt). I know to update the vector to use:

lookat.x = radius*cos(phi)*cos(theta);
lookat.y = radius*sin(phi);
lookat.z = radius*cos(phi)*cos(90.0-theta);

But I can't seem to compute a phi and theta that work correctly. I'm pretty new to opengl.

Alfonse Reinheart
11-11-2010, 02:26 PM
Why not just do the rotation and translation yourself instead of using gluLookAt?

shoke
11-11-2010, 02:27 PM
Because t's for a lab for a class and the professor said so.