title: Direction vector to a rotation (three.js)
body: <p>I'm attempting rotate an arrow on the surface of a planet to face the direction it is traveling. I can get the direction vector and the up vector from the surface normal. How would I go about turning this into a quaternion for my arrows rotation. I'm using three.js so any suggested methods they provided that I can use would be useful. Cheers.</p>
  
  <p><a href="https://i.stack.imgur.com/bkB8P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bkB8P.png" alt="enter image description here"></a></p>
  
  <p>The information I have so far.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>var upVector = new THREE.Vector3();
  upVector.subVectors( new THREE.Vector3(0,0,0), lastVec );
  
  var dirVector = new THREE.Vector3();
  upVector.subVectors( lastVec, destVec );
  
  var sideVector = new THREE.Vector3();
  sideVector.crossVectors( dirVector, upVector );
  
  var newUp = new THREE.Vector3();
  newUp.crossVectors( dirVector, sideVector );</code></pre>
  </div>
  </div>
  </p>