martijn - 1 year ago 204

Javascript Question

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?

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

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();
euler.setFromQuaternion(quat);
alert('X in degrees: ' + euler.x + '\n' +'Y in degrees: ' + euler.y + '\n' + 'Z in degrees: ' + euler.z);
```

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**