Libgdx: Problem with getPitch() and getRoll()

Created on 8 Oct 2017  路  1Comment  路  Source: libgdx/libgdx

Details

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

Code:

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());

This code after execution displays in my console:

libgdx version: 1.9.6
0.0; 90.0; 0.0
bug

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(), and getRoll() have multiple possible solutions.

>All comments

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.

Was this page helpful?
0 / 5 - 0 ratings