How to move the camera sideways in libgdx
        Posted  
        
            by 
                Bubblewrap
            
        on Game Development
        
        See other posts from Game Development
        
            or by Bubblewrap
        
        
        
        Published on 2012-04-02T08:37:43Z
        Indexed on 
            2012/04/02
            11:44 UTC
        
        
        Read the original article
        Hit count: 1142
        
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.
© Game Development or respective owner