Skip to content

Instantly share code, notes, and snippets.

@thiagopnts
Created February 5, 2018 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thiagopnts/f1725f13c39ae29807b489b52b842048 to your computer and use it in GitHub Desktop.
Save thiagopnts/f1725f13c39ae29807b489b52b842048 to your computer and use it in GitHub Desktop.
const direction = this.viewer.camera.getWorldDirection();
const theta = Math.atan2(direction.x, direction.z);
const angle = (theta * 180 / Math.PI + 90) * -1;
this.$compass.style.transform = `rotate(${angle}deg)`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment