Original Post
Hi,
I am coding it so that I can rotate the camera using the mouse, and I followed the steps in this tutorial:
http://www.psky.com/prog/camera.htm
Heres my version of his rotation code:
look_x = cos( y_angle ) * cos( x_angle ); look_y = sin( x_angle ); look_z = sin( y_angle ) * cos( x_angle ); lookup_x = -cos( y_angle ) * sin( x_angle ); lookup_y = cos( x_angle ); lookup_z = -sin( y_angle ) * sin( x_angle ); view.x = x + look_x; view.y = y + look_y; view.z = z + look_z;y_angle translates to theta in the tutorial, and x_angle to phi. view is a vector that represents the world-space coordinates of the look-at point. I started off with the camera positioned at [0,0,-5], and pointing torwards the origin. When I move the cursor left or right the object on the screen disappears, and I have to keep rotating to get it back on. From there it appears to be rotating correctly though, with the odd error that moving the mouse left makes the object on the screen move left (instead of right, in other words moving the camera left rotates the camera right so that the object appears to move left). I first had the cameras starting angle at 0, but I tried changing it to 270 yet there was no change. Is something wrong with the code? Any ideas what I could be doing wrong? If you need more code just let me konw. Thanks, Tom