View Full Version : moving left & right glulookat
12-31-2001, 03:28 PM
could someone please explain how to move left and right (strafe) with gluLookAt?
01-02-2002, 01:12 AM
Not sure what you have problem with, using gluLookAt is just a question of modifing the camera position and what the camera is looking at (and the up vector), What do you mean with "left", if you have the camera pointing along the Z axis then you can move it left by subtracting a value from the x position in the camera position and the camera target vector.
01-02-2002, 01:49 AM
Thanks for your reply,
what i want to be able to do is strafe left or right, relative to my position and where im looking at.
I wish i could give you more information but i can't think how to explain it more http://www.opengl.org/discussion_boards/ubb/frown.gif
01-02-2002, 04:21 AM
What you want requires a bit more complex math than OpenGL provides. You really need a general Matrix (or quaternion) library.
However, if you've got the FORWARD and UP vectors, the 'strafing' vector is just the cross product of the two others.
e.g. Assuming UP is A(x,y,z) and FORWARD is B(x,y,z), strafing is C(x,y,z), strafing can be calculated as follows:
Cx = AyBz - AzBy
Cy = AzBx - AxBz
Cz = AxBy - AyBx
But you really want a meth library sooner rather than later http://www.opengl.org/discussion_boards/ubb/smile.gif
01-02-2002, 10:54 AM
Great, thanks! i will try it out
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.