View Full Version : strafing
could someone please tell me how to implement strafing using gluLookAt?
12-31-2001, 06:34 PM
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.
01-03-2002, 06:30 AM
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
strafe left = turn left, move forward, turn right.
Isn't that simple http://www.opengl.org/discussion_boards/ubb/smile.gif
Just make yourself a class for your camera that keeps your position and angles on the 3 axis.
Hope it helped.
*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
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.