PDA

View Full Version : 3D camera help needed ASAP!!! :-O



yoda
11-02-2000, 08:13 PM
I have been instructed to use the gluLookAt(?) function to do this but I'm not sure how to view a scene which contains multiple 3D objects traveling along their own paths, in a manner that will allow me to look at those objects from a camera which can move in a spherical path/orientation! Can you guys please help me out?

Cheers...

jc
11-02-2000, 10:52 PM
If you have two cubes moving (differently) in a 3D world and if you to look at the first one (moving in a spherical path), you can use the glulookat function.
The camera is centered in the world, moving in a spherical path you'r camera is like moving the entire world around its center, u see what i mean ?

If you don't see what does the glulookat function, u can also use gltranslate and glrotate to do this. If you'r looked object is A(xa, ya,za), do:

//**** the camera is centered in the world
gltranslatef(xa, ya, za);
//**** it's stil centered in the world but you can imagine it's the camera whitch is moving inthe world
glrotatef(xangle, 1.f, 0.f, 0.f);
glrotatef(yangle, 0.f, 1.f, 0.f);
glrotatef(zangle, 0.f, 0.f, 1.f);
glTranslatef(-xa, -ya, -za);

or you can use the glulookat (don't forget to determine the look up axe !!! )

Hope that helped

yoda
11-03-2000, 10:42 AM
Thanks...I'll try that!

Cheers... http://www.opengl.org/discussion_boards/ubb/smile.gif