View Full Version : Trying to move a Camera

Stack Overflow

12-26-2002, 08:11 AM

Hello,

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.

- VC6-OGL

mikael_aronsson

12-26-2002, 08: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 ?

Mikael

Stack Overflow

12-26-2002, 08:19 AM

How would I setup glRotate to use my sin and cosine's?

- VC6-OGL

chxfryer

12-26-2002, 06: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.)

wahidmemon

12-29-2002, 07:30 AM

Originally posted by VC6-OGL:

How would I setup glRotate to use my sin and cosine's?

- VC6-OGL

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.

psybases

12-30-2002, 11:45 AM

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.

Powered by vBulletin® Version 4.2.5 Copyright © 2018 vBulletin Solutions Inc. All rights reserved.