title: Inverse of camera.lookAt()
body: <p>I googled far and wide but I haven't found the solution to what I think to actually be a pretty common situation. Say I have a <code>THREE.PerspectiveCamera</code> initialized to look at a certain point in space:</p>
  
  <pre><code>var camera = new THREE.PerspectiveCamera(45, 2, 0.1, 100);
  var target = new THREE.Vector3(1, 2, 3);
  camera.lookAt(target);
  </code></pre>
  
  <p>Now, later on in the code I'd like to be able to find out the coordinates of <code>target</code> by simply querying <code>camera</code>.<br>
  I tried what suggested in <a href="https://stackoverflow.com/questions/15696963/three-js-set-and-read-camera-look-vector">this question</a>, adapting it to my own scenario:</p>
  
  <pre><code>var vector = new THREE.Vector3();
  vector.applyQuaternion(camera.quaternion);
  console.log(vector);
  </code></pre>
  
  <p>But it logs a vector of coordinates <code>(0, 0, 0)</code> instead of the correct coordinates (which, in my example, should be <code>(1, 2, 3)</code>).<br>
  Any insights? Cheers.</p>
  
  <p><strong>EDIT:</strong><br>
  Ok so I'm going to try to contextualize here, so as to justify why MrTrustworthy's solution is unfortunately not applicable in my scenario. I'm trying to tweak the <code>THREE.OrbitControls</code> library for my purposes, since I noticed that when using it, it overrides whichever position the camera was looking at originally. This has also been reported <a href="https://stackoverflow.com/a/21922316/1154866">here</a>. Basically, on line 36 of <code>OrbitControls.js</code> (I'm using the version which can be found <a href="http://threejs.org/examples/js/controls/OrbitControls.js" rel="nofollow noreferrer">here</a>) <code>this.target</code> is initialized to a <code>new THREE.Vector3()</code>; I found out that if I manually set it to equal the same vector I use as argument of <code>camera.lookAt()</code> everything works just fine: I can start panning, orbiting and zooming the scene from the same POV I would see the scene from if I didn't apply the controls. Of course, I cannot hard-code this information into <code>OrbitControls.js</code> because it would require me to change it every time I want to change the initial "lookAt" of my camera; and if I were to follow MrTrustworthy's suggestion I would have to change line 36 of <code>OrbitControls.js</code> to read like this: <code>this.target = object.targetRef</code> (or <code>this.target = object.targetRef || new THREE.Vecotr3()</code>), which is also too "opinionated" (it would always require <code>object</code> to have a <code>targetRef</code> property, whereas I'm trying to stick to using only three.js's existing object properties and methods). Hope this helps get a better understanding of my case. Cheers.</p>