PDA

View Full Version : changing viewpoints



03-08-2001, 06:09 AM
Hello, I am very new to openGL, and I'm having a bit of a problem. I have this assignment to animate a ferris wheel, with the ability to look at it from a point not on the ride, as well as from the viewpoint of someone actually on the ferris wheel. I have the off-the-ride down ok, but how on earth do I get the camera to sit in one of the cars? I've tried a few things with disastrous results, using gluLookAt.

Basically, what I need is a way to put the camera in the position of someone in one of the cars as it goes around. I also need a way to switch from that POV to off the ride.

Can someone please help? And use small words, I'm still learning... http://www.opengl.org/discussion_boards/ubb/wink.gif
Thanks

RandyU
03-08-2001, 08:48 PM
Here is an idea. I dont know if it works...
//let x0,y0,z0 - center of wheel.
glTranslatef(x0,y0,z0)//translate to the center
glRotatef(a,0,0,1)//rotate on a angle. Arround axis of rotation of wheel. Let it be z-axis
glTranslatef(0,r,0)//r is wheel's radius. Now we are in the "car" on the top of wheel. (0,r,0) must be orthogonal to (0,0,1)

glRotatef(90,0,0,1)// - adjust viewing agle so we look in the direction of movement