robert

12-31-2001, 04:28 PM

could someone please explain how to move left and right (strafe) with gluLookAt?

Thanks!

Thanks!

View Full Version : moving left & right glulookat

robert

12-31-2001, 04:28 PM

could someone please explain how to move left and right (strafe) with gluLookAt?

Thanks!

Thanks!

mikael_aronsson

01-02-2002, 02:12 AM

Hi !

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.

Mikael

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.

Mikael

robert

01-02-2002, 02: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

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

NicholasFrancis

01-02-2002, 05: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

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

robert

01-02-2002, 11:54 AM

Great, thanks! i will try it out

Powered by vBulletin® Version 4.2.3 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.