View Full Version : Camera rotation about a point.

11-07-2005, 01:25 PM
Hi People,

Just wondering how to calculate the new eye position when using the gluLookAt function after a mouse event.

I have been searching the web for ages trying to find out how to do this so please help:

The problem

To rotate the camera around an arbitary point at a given distance away from the camera.

I'm assuming that i'll be using the gluLookAt function - my problem is that i don't know how to calculate the new position of the camera from a delta x / y value.

The best example of this i can think of is when using maya - when you press down the ALT key, you can rotate the camera around the current focal point. When you move the camera (up down keys etc), the focal point moves too etc.

Any help would be really appreciated and also a description would be a bonus.



11-08-2005, 12:27 PM
you could use standard rotation matrices if you translate the eye-point and target-point in such a way that the target-point moves to the origin. then do the rotation and translate it back.