View Full Version : Rotating viewpoint around a 3d object
10-25-2001, 06:43 AM
Hey everyone. I have a question about rotating my viewpoint around an object. I know how to rotate the actual object (ex. glRotatef(angle, 0,1,0) ), but i want to know how to rotate my VIEWPOINT around. Hope that makes sense. Thanks
10-25-2001, 06:48 AM
Rotating or moving your viewpoint and moving the models are essentially the same thing. For instance, you can either move the model away from the camera 10 meters or move the camera away from the model by 10 meters. Both are the same code, it's just a matter of how you think about it. You still use the MODELVIEW matrix for both.
10-25-2001, 11:31 AM
I suggest you use gluLookAt for your camera system and you can turn around a point with cos and sin and an angle around the y axis by setting your AT coords to the position of the object you want to turn around
and set your camera's EYE coords to this :
X : distance*cos(angleY)
Z : distance*sin(angleY)
and increment your angleY at each loop
Hope it helps !
*Sleep is a waste of time*
10-25-2001, 05:29 PM
there is some good camera movement
code in this project:
10-25-2001, 08:56 PM
To avoid confusing, you'd better consider the whole 3D sence standstill with absolute coordinates but the camera moves.
All that you need to do is to handle the movement of the eye coordinates and the target coordinates and then call gluLookAt(). You may check my Pool3D page on http://zone999.top263.net
Hope you know what.
[This message has been edited by Dong Ke (edited 10-25-2001).]
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.