How to move the camera sideways in libgdx
- by Bubblewrap
I want to move the camera sideways (strafe/truck), now i had the following in mind, but it doesn't look like there are standard methods to achieve this in libgdx.
If i want to move the camera sideways by x, i think i need to do the following:
Create a Matrix4 mat
Determine the orthogonal vector v between camera.direction and camera.up
translate mat by v*x
multiply camera.position by mat
Will this approach do what i think it does, and is it a good way to do it?
And how can i do this in libgdx? I get "stuck" at step 2, as in, i have not found any standard method in libgdx to calculate an orthogonal vector.
EDIT: I think i can use camera.direction.crs(camera.up) to find v. Guess i can now try this approach tonight and see if it works.