When I set euler angles (0, 0, 90) on quaternion, and try to get this angles, the program returns (0, 90, 0).
Is this the normal behavior of the program? Can be this fixed?
The problem appears only when the angles are (0, 0, 90). If you make angles like (0, 45, 90), it works fine.
setEulerAngles() applies angles to the object correctly.
I run the program on Linux Mint 18.2 Sonya
System.out.println("libgdx version: " + Version.VERSION);
Quaternion rotation = new Quaternion();
rotation.setEulerAngles(0, 0, 90);
System.out.println(rotation.getYaw() + "; " + rotation.getPitch() + "; " + rotation.getRoll());
libgdx version: 1.9.6
0.0; 90.0; 0.0
This isn't a bug. It's Gimbal lock, which is a mathematical limitation of Euler angles. At certain orthogonal combinations of angles, getYaw(), getPitch(), and getRoll() have multiple possible solutions.
Most helpful comment
This isn't a bug. It's Gimbal lock, which is a mathematical limitation of Euler angles. At certain orthogonal combinations of angles,
getYaw(),getPitch(), andgetRoll()have multiple possible solutions.