There is a method in org.joml.Quaternionf:
- rotateX(angle in rad)
which can get the job done but how do I calculate the appropritate angle? It doesn't help to just rotate by -x because x value of quaternion is not the same as the actual angle around X axis. Example:
Quaternionf q = (-0,942 -0,023 -0,329 0,067) // Quaternion to rotate new Quaternionf(q).rotateX(-q.x) = (-0,809 -0,17 -0,283 0,487) // not what I want new Quaternionf(q).rotateX(3) = (0 -0,33 0 0,944) // exactly what I want because x = 0 Maybe other methods should be used instead that can make it in one line?
Источник: https://stackoverflow.com/questions/780 ... so-its-x-0
Мобильная версия