You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I realize it's been 6 years but, if you store the orientation as a quaternion (e.g. THREE.Quaternion), you can use the following functions to find the pitch and roll:
function pitch(orientation: Quaternion): Number {
let forward = orientation.multiply(new Vector3(0, 0, -1));
let forward2d = new Vector2(Math.hypot(forward.x, forward.z), forward.y);
return Math.atan2(forward2d.y, forward2d.x)
}
function roll(orientation: Quaternion): Number {
return orientation.toEuler("YXZ")[2];
}
Note: you may have to convert the result from radians to degrees before passing it to this library.
Excuse me Sir, I want to ask about this. What does these lines mean? How to get calculation for pitch and roll?
Thank you for your attention
The text was updated successfully, but these errors were encountered: