three.js perspectivecamera current angle in degrees

1.5k views Asked by At

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?

1

There are 1 answers

1
Kevin Kuyl On BEST ANSWER

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();
euler.setFromQuaternion(quat);

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