Thread: Rotating viewpoint around a 3d object

1. Rotating viewpoint around a 3d object

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

2. Re: Rotating viewpoint around a 3d object

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.

3. Re: Rotating viewpoint around a 3d object

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 !

-------------------------------------------
Evil-Dog
*Sleep is a waste of time*

4. Re: Rotating viewpoint around a 3d object

there is some good camera movement
code in this project:
[<http://astronomy.swin.edu.au/pbourke/opengl/stereogl/>]

5. Re: Rotating viewpoint around a 3d object

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).]

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•