Search code examples
three.js

Get euler rotation from Quaternion?


I'm using FlyControls for moving and rotation my plane (I'm doing a flight sim), and it works pretty well. However now I have ran into a problem where one possible solution would be to know the euler angles of my plane. Unfortunately FlyControls is using Quaternion. Is there a possible way to get the angles somehow? Of course, I could rewrite the FlyControls module to use euler angles. But I would like to avoid that if possible.


Solution

  • const rotation = new THREE.Euler().setFromQuaternion( quaternion, eulerOrder );
    

    three.js r.69