I want to know the values of x
, y
, z
satisfying the following.
float ax = 30;
float ay = 40;
float az = 50;
var rotation1 = Quaternion.Euler(ax, ay, az).eulerAngles;
var quaternion = Quaternion.identity;
quaternion = Quaternion.AngleAxis(x, Vector3.right) * quaternion;
quaternion = Quaternion.AngleAxis(y, Vector3.up) * quaternion;
quaternion = Quaternion.AngleAxis(z, Vector3.forward) * quaternion;
var rotation2 = quaternion.eulerAngles;
Assert.AreApproximatelyEqual(rotation1, rotation2);
ax
, ay
, az
can be arbitrary value. Unity's operation between quaternion and euler angle (Vector3) seems to rotate by Z axis first, so I think x, y, z won't be equal to ax, ay, az.
How can I derive x
, y
, z
?