Hi all, i hope this is the right place to ask for my problem.
I want to convert a quaternion into euler angles but values looks wrong.
This is the piece of code
// values are in x, y, z, w order
var rot = new BABYLON.Quaternion(-0.1245631, 0.7443593, -0.6470615, -0.108281);
var euler = rot.toEulerAngles();
if i print euler, the content is
X: 1.4311703869613368 Y: 3.141592409759389 Z: -0.33161295970567284
and if i converted in degrees with BABYLON.Angle(angle_rad).degrees(), they are around
X: 82 Y: 179 Z:340
but the values are wrong. The values i expect are X: 98 Y: 0 Z: 161
I tested the quaternion value also in Unity3D and online tools and all returns 98, 0, 161.
But another stranger thing is if i set the values (-0.1245631, 0.7443593, -0.6470615, -0.108281)
to a quaternion of an object in Unity3D, the object rotate correctly,
while if i set the values in a quaternion of Babylon, the rotation object is different.
Maybe the euler problem is just an effect and the real problem is the quaternion itself.
What’s wrong? I spent a whole day figuring out what’s wrong.
Thanks at all