View Full Version : Trying to move a Camera

Stack Overflow
12-26-2002, 09:11 AM

I am trying to move a Camera using sine's and cosine's, but I don't know where to start. I am using glLookAt(), but how would I program the rotation to use my defined variable that contains my sine's and cosine's.


12-26-2002, 09:18 AM
Hi !

If you are using sin and cosine I assume that you want to rotate the camera in some way ?, in that case why not use glRotate instead ?


Stack Overflow
12-26-2002, 09:19 AM
How would I setup glRotate to use my sin and cosine's?


12-26-2002, 07:34 PM
Are you trying to move the camera along a cos or sin wave or rotating the camera?
if moving along:
glulookat has params that are the position of camera. Change those params according to your wave equation
if rotating the camera:
glulookat has params that are the position in 3d space the camera looks at. Use rotation formula to rotate those coordinates and the camera will turn.

I dont know if I helped. More help can be located at www.gametutorials.com. (http://www.gametutorials.com.)

12-29-2002, 08:30 AM
Originally posted by VC6-OGL:
How would I setup glRotate to use my sin and cosine's?


its very much simple to transform the camera in any desired direction or location or orient it, simply calculate the sin or cos values and stored in some variable and use those variables in glRotatef() if u want it to rotate or glTranslatef() if u want it to move somewhere.

12-30-2002, 12:45 PM
I believe that the most appropriate way is to use some Matrices.
Try to make up some Matrices from your sin and cos and then multiply tha Modelview matrix.