PDA

View Full Version : rotating a camera around a point.



seckley
08-02-2007, 05:39 PM
Hi ;
i' taking a graphics class and i'm trying to write a camera class that i can reuse through out the rest of the course. i have it so that i can do the pitch, yaw roll and slide through the three dimensions. Now i would like to add the ability to rotate the camera around an object. I'm using vectors to orient the camera. What i have is based upon what i found in my text book. i can't seem to make the camera move without the point of view moving. Any suggestions?

D.M.Phillips
08-02-2007, 08:59 PM
Your question is not quite clear.
If you are actually trying to orbit the camera around a 3-space object the point of view will change continuously.

If you are just rotating the camera around a centerline through the lense to the object the rotational transformations are straightforward
and if GL doesn't have a routine for this I will be happy to e-mail them to you.

Hope this helps
D.M.Phillips

dletozeun
08-03-2007, 08:50 AM
Maybe that would help you:

http://www.opengl.org/discussion_boards/ubb/ultimatebb.php?ubb=get_topic;f=2;t=021484

Lindley
08-03-2007, 10:33 AM
If I understand correctly, you already have a method to translate the camera around to different positions, and you have a method to rotate it in place.

Thus, to rotate around a point it's observing:
1) translate "forward" to the point.
2) rotate as desired, in place
3) translate "backward" to the original viewing distance.

Of course, the forward and backward vectors will be things you'll need to calculate. The forward one should be easy, at least.