Getting Yaw in 0 - 360 degrees
Hey there, I'm trying to extract the yaw (y rotation) as a value that goes from 0 - 360 degrees (or 0 - two pi radians, doesn't matter) using the rotational device tracking.
I get the initial euler angle like so
```
var rotation = script.deviceTracking.getTransform().getWorldRotation().toEulerAngles();
```
However when I print the y value of the rotation, the numbers look odd to me.
Starting at 360 and rotating clockwise, the values decrease to 270, then back up to 360/0 then increase to 90 and then back down to 0. That makes a full rotation. Here's a video printing the rotation as the camera spins.
https://drive.google.com/file/d/1t3ALvh5Aha0w2byVOArreGdzAWp4MEpT/view?usp=sharing
Any help getting a continuous rotation value would be great!
Okay, actually think going from quats to euler was a bad idea. Instead I used the forward vector to derive the rotation values.
I also derived pitch using the forward vector as well.
```
var forward = script.deviceTracking.getTransform().forward;
var yaw = Math.atan2(forward.z, forward.x) + Math.PI // y rotation
var pitch = Math.asin(forward.y) * -1 // x rotation
```
Hi, Adam!
Yes, quats are always better !
Let me know if there are any questions!