PDA

View Full Version : strafe???

brispace
07-22-2005, 10:00 PM
can some one help me with how to formulate new coords that allow the camera to strafe from side to side?

i know what needs to be gone.. i just cant remember from high school how to do it.

i am using gluLookAt for a first person view and i know i just need to move the position and the view coords perpendicular to the slope of position-to-view.

here is a diagram i made if it helps at all:

http://www.geocities.com/brispace/help.bmp

thank you!

CWiC
07-22-2005, 11:40 PM
Vector multiplication of view vector and up vector gives you one strafe direction. Multiply it with -1 for another direction.

brispace
07-23-2005, 01:39 AM
so you are saying that if my position is (7,17) and my view is (8, 16), i multiply to get the scalar product?

example:

( 7, 17 ) · ( 8, 16 )
( 7 x 8 + 17 x 16 )
(56 + 272) = 328

ok so now i have a scalar product of 328, now what do i do with it.. i am stuck again?

dr
07-23-2005, 06:32 AM
try cross product, not dot product

http://en.wikipedia.org/wiki/Cross_product