Strafing and vector cross products

Hey everyone,



I’m currently working on strafing by taking the cross-product of the look direction vector and (0, 1, 0), but I’m unsure which direction (left or right) the cross-product will yield. Is there a solid way to figure this out without trial and errors?



thanks!

jW

Where do you get your look direction? (Camera already provides a left vector is why I ask…)

The look direction is a property of the data type I’m strafing. The camera is separate. (thanks for the speedy response!)

…but to answer your question anyway… it depends on which order you are doing the cross product, up.cross(look) or look.cross(up). I think look.cross(up) points right but it’s easy to test… if new Vector3f( 0, 0, -1 ).cross( new Vector3f( 0, 1, 0 ) ).x == 1 then the vector points right.

Thanks a bunch, that was incredibly helpful! Happy coding!