title: LibGDX - perspective camera smooth translation & direction
body: <p>I am trying to implement smooth 3D camera in my game. So, I have a few reserved positions and directions and I want to change view of my camera by applying them to my camera. Now I am doing it like below:</p>
  
  <pre><code>//Reserved positions and directions
  
  //View #1
  Vector3 pos1 = new Vector3(0, 5, -10);
  Vector3 dir1 = new Vector3(0, 0, 10);
  
  //View #2
  Vector3 pos2 = new Vector3(5, 2, 5);
  Vector3 dir2 = new Vector3(-2, 2, 7);
  
  //Applying view #2
  camera.position.set(pos2);
  camera.lookAt(dir2);
  </code></pre>
  
  <p>It works, but I need to do it smoothly. I've seen a <a href="https://stackoverflow.com/questions/13227994/how-to-make-a-smooth-camera-follow-algorithm-libgdx">similar question for 2D camera</a>, but it doesn't appropriate for me, because orthographic camera doesn't need direction and Z-axis.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I tried to use method which is described for 2D camera. So, positioning works as needed, but I can't say the same about direction. Behaviour of direction is wrong. It rotates camera on Z-axis. Seems to me I have to update <code>Up</code> vector too.</p>
  
  <pre><code>float lerp = 0.01f;
  Vector3 position = camera.position;
  position.x += (pos2.x - position.x) * lerp;
  position.y += (pos2.y - position.y) * lerp;
  position.z += (pos2.z - position.z) * lerp;
  
  Vector3 direction = camera.direction;
  direction.x += (dir2.x - direction.x) * lerp;
  direction.y += (dir2.y - direction.y) * lerp;
  direction.z += (dir2.z - direction.z) * lerp;
  
  //CODE FROM LIBGDX'S CAMERA
  //LookAt function
  /*
  tmpVec.set(x, y, z).sub(position).nor();
      if (!tmpVec.isZero()) {
          float dot = tmpVec.dot(up); // up and direction must ALWAYS be orthonormal vectors
          if (Math.abs(dot - 1) &lt; 0.000000001f) {
              // Collinear
              up.set(direction).scl(-1);
          } else if (Math.abs(dot + 1) &lt; 0.000000001f) {
              // Collinear opposite
              up.set(direction);
          }
          direction.set(tmpVec);
          normalizeUp();
      }
  */
  </code></pre>
  
  <p>What is the correct way to set direction?</p>