It seems like the issue could be related to converting quaternion rotations. I'm not entirely certain if the code snippet below is accurate, but it may assist you in resolving the problem.
const euler = new THREE.Euler();
const rotation = euler.setFromQuaternion(camera.quaternion);
const radians = rotation.z > 0
? rotation.z
: (2 * Math.PI) + rotation.z;
const degrees = THREE.Math.radToDeg(radians);
After running this code, the variable degrees
should hold a value ranging from 0 to 360. However, as the camera rotates, the angle values appear to fluctuate inconsistently.
You can observe this behavior in action by visiting this CodePen:
http://codepen.io/kevanstannard/pen/NdOvoO/
I referenced information from the following question while working on this:
three.js perspectivecamera current angle in degrees
Edit #1
Upon reviewing @WestLangley's response, it appears that my initial solution was incorrect. To clarify and implement West's suggestion, here's some revised code:
// Set Y to represent the camera's heading
camera.rotation.order = 'YXZ';
Followed by:
const heading = camera.rotation.y;
const radians = heading > 0 ? heading : (2 * Math.PI) + heading;
const degrees = THREE.Math.radToDeg(radians);
For a more polished demonstration, check out this updated CodePen:
http://codepen.io/kevanstannard/pen/YNJgXd