title: How to move a camera left and right in LibGDX
body: <p>I have a camera which I control using WASD, but I'm stuck on moving it left and right. I've been looking all over the internet and it says to find a vector perpendicular to another you change the x and y round and times one of them by -1. I've tried this in the code below:</p>
  
  <pre><code>void camstrafe (String dir) {
      Vector3 direction = camera.direction.nor();
      Vector3 old = direction;
      direction.set(-old.z, 0, old.x);
      camera.translate(direction.scl(0.18f));
  }
  </code></pre>
  
  <p>I have moving forwards working fine, and actually turning the camera round, but for some reason this doesn't work, and to be honest I'm not sure what it really does because when I press <code>a</code> or <code>d</code> (they call this function) the camera just goes crazy and starts turning round really quickly and sometimes going forwards or like a million miles sideways. Anyway, does anyone know how I could do this properly? By the way I've also tried getting the forward direction of the camera and using the <code>.rotate()</code> function rotating it 90 degrees right/left then translating it that way but that does the same thing. I'm thinking maybe cameras don't work the same was as other things do when translating them sideways/backwards.</p>