Bence
Bence

Reputation: 333

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.

Upvotes: 10

Views: 12790

Answers (1)

WestLangley
WestLangley

Reputation: 104783

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

three.js r.69

Upvotes: 19

Related Questions