martijn martijn - 1 year ago 136
Javascript Question

three.js perspectivecamera current angle in degrees

For a project I use a PerspectiveCamera which gets rotated using the vrcontrols from r69. At one point I require the current viewing angle degrees (horizontal & vertical degrees at which direction the camera is looking at). How would I acquire those?

Answer Source

What you want are also called euler angles. Three.js eulers have a built in function to set them from a quaternion.

var quat = new THREE.Quaternion();
var euler = new THREE.Euler();

alert('X in degrees: ' + euler.x + '\n' +'Y in degrees: ' + euler.y + '\n' + 'Z in degrees: ' + euler.z);