could someone please tell me how to implement strafing using gluLookAt?

Thanks!

could someone please tell me how to implement strafing using gluLookAt?

Thanks!

What you do is, you Cross Product the look vector, which is just where you are looking, minus where you are, then normalised, you cross product this with the up vector, which is usually 0.0, 1.0, 0.0, this gives you the sideways vectror. Then you have to change your look at and position values according to this side vector and there you have it.

Hi. I think someone who don’t how to strafe don’t know what is a cross product hehehe

What you have to do to strafe is logical.

just draw it on a paper. you’ll see that to strafe, you just move your object on the lateraly. with angle of +/- 90 degrees.

To put very very simply :

strafe right = turn right, move forward, turn left

and

strafe left = turn left, move forward, turn right.

Isn’t that simple

Just make yourself a class for your camera that keeps your position and angles on the 3 axis.

Hope it helped.

Evil-Dog

*Sleep is a waste of time*

also the current matrix (after glulookat) contains in the topleft 3x3 the forward vector, the up vector + the sideways vector aka the strafe vector