title: three.js rotate camera in plane
body: <p>I have a camera in my app:  </p>
  
  <pre><code>camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
  camera.position.z = 1;
  camera.position.y = -5;
  camera.rotateOnAxis(new THREE.Vector3(1, 0, 0), degInRad(90));
  camera.up = new THREE.Vector3(0, 0, 1);  
  </code></pre>
  
  <p>Those code in <code>render</code> function must rotate the camera while I'm pressing the keys:  </p>
  
  <pre><code>if (leftPressed) {
      camera.rotateOnAxis((new THREE.Vector3(0, 1, 0)).normalize(), degInRad(1));
  } else if (rightPressed) {
      camera.rotateOnAxis((new THREE.Vector3(0, 1, 0)).normalize(), degInRad(-1));
  }
  if (upPressed) {
      camera.rotateOnAxis((new THREE.Vector3(1, 0, 0)).normalize(), degInRad(1));
  } else if (downPressed) {
      camera.rotateOnAxis((new THREE.Vector3(1, 0, 0)).normalize(), degInRad(-1));
  }  
  </code></pre>
  
  <p>Camera rotates, but not in way I need. I want that camera rotates like in FPS (first person shooter) on plane. See picture to understand what I want...<br>
  I'm try to use <code>sin(1)</code> and <code>cos(1)</code> but can't understand how <code>rotateOnAxis</code> works, cause <code>translate</code> functions work like a charm and moves camera in direction in what she sees.<br>
  <strong>P.S.</strong><br>
  Here is a <a href="http://threejs.org/docs/" rel="nofollow noreferrer">docs</a> to the <code>three.js</code> maybe it helps.<br>
  To handle keyboard events I use <a href="http://robertwhurst.github.io/KeyboardJS/" rel="nofollow noreferrer">KeyboardJS</a><br>
  And here is a <code>degInRad</code> function:  </p>
  
  <pre><code>function degInRad(deg) {
      return deg * Math.PI / 180;
  }  
  </code></pre>
  
  <p>Link on <a href="http://jsfiddle.net/ostapische/uFwFC/" rel="nofollow noreferrer">JSFiddle</a>  </p>
  
  <p><img src="https://i.stack.imgur.com/cvC1j.jpg" alt="camera rotation"></p>
  
  <p><code>O</code> - position of camera<br>
  <code>O-O1</code> - current camera direction<br>
  <code>R1</code> - current rotation direction<br>
  <code>R</code> - direction what I want<br>
  Sorry for <em>good</em> picture.</p>