# Rotating gluLookAt

Hi,
In my little application I am using gluLookAt to simulate a camera. I have it working so that it can strafe left and right, move forward and backward easily enough, but I cannot figure out how to rotate the position on the x axis (left and right) it is looking at, so that it rotates the ‘camera’ as such.
Thankyou.

I’m not sure I understand what you want. You want to orbit around an object? Or roll the camera?
If you want to orbit, then the camera moves on a plane (xz assuming that y is the up vector) not on an axis and you will have to use sin and cos functions:
x=orbit_radiuscos(angle)
z=orbit_radius
sin(angle)
and just increase or decrease the angle.
If you want to roll the camera you need to rotate the up vector.

I am thinking sort of like a First Person Shooter, where you can ‘turn’ the character left and right, by swivelling the camera around.

Can you explain the Up Vector please?

Originally posted by Swiftless:
Can you explain the Up Vector please?
:eek: Vector that points upwards?!?!?!
That's what Google found about gluLookAt
The Red Book
NeHe Tutorials
FireStorm Tutorials .

So how would I rotate the ‘camera’ with gluLookAt? I have done google searches but they only talk about using the Translate and Rotate functions.

Just by changing the LookAt arguments. Do some maths in order to achive your goals.

Thats the thing, I do not know which Maths to do…

First try to apply the maths you already know. I guess you know how to rotate a point in a 2D plane.

And as that’s the thing, maybe the maths and algorithm forum will best fit your needs.

OK, Thanks

Swiftless, HI:

If we want strafe, we can change eyex/y/z in gluLookAt to get that effect.

Originally posted by Swiftless:
OK, Thanks

I already have strafe working perfectly, the problem was and currently still is, rotating the view.