title: Apply Quaternion to Camera in libGDX
body: <p>I am trying to rotate my camera using a <code>Quaternion</code> in libGDX. I have a <code>Quaternion</code> created and being manipulated but I have no idea how to apply it to the camera, everything I've tried hasn't moved the camera at all.</p>
  
  <p>Here is how I set up the rotation <code>Quaternion</code>:</p>
  
  <pre><code>    public void rotateX(float amount) {
          tempQuat.set(tempVector.set(1.0f, 0.0f, 0.0f), amount * MathHelper.PIOVER180);
          rotation = rotation.mul(tempQuat);
      }
  
      public void rotateY(float amount) {
          tempQuat.set(tempVector.set(0.0f, 1.0f, 0.0f), amount * MathHelper.PIOVER180);
          rotation = tempQuat.mul(rotation);
      }
  </code></pre>
  
  <p>Here is how I am trying to update the camera (Same update method as the original libGDX version but I added the part about the rotation matrix to the top):</p>
  
  <pre><code>    public void update(boolean updateFrustum) {
          float[] matrix = new float[16];
          rotation.toMatrix(matrix);
          Matrix4 m = new Matrix4();
          m.set(matrix);
  
          camera.view.mul(m);
          //camera.direction.mul(m).nor();
          //camera.up.mul(m).nor();
  
          float aspect = camera.viewportWidth / camera.viewportHeight;
          camera.projection.setToProjection(Math.abs(camera.near), Math.abs(camera.far), camera.fieldOfView, aspect);
          camera.view.setToLookAt(camera.position, tempVector.set(camera.position).add(camera.direction), camera.up);
          camera.combined.set(camera.projection);
          Matrix4.mul(camera.combined.val, camera.view.val);
  
          if (updateFrustum) {
              camera.invProjectionView.set(camera.combined);
              Matrix4.inv(camera.invProjectionView.val);
              camera.frustum.update(camera.invProjectionView);
          }
      }
  </code></pre>