Use Quaternion.toAngles(null) to get the angles, but no, there are many ways to store the same rotation. This starts with the fact that you can rotate 90° right or 270° left and when you combine rotations there are many ways to get there, so I think a Quaternion will always be the most compact way (smallest angles) to get there.
Apart from that: 1. Sample output would be cool, 2. What are you trying to do? There most likely is a better way for that.
I dont’ understand how to get the angles by Quaternion.toAngles(null). Could you explain this a bit more exact?.
I must admit that i don’t understand the values i get back when i rotate a node. Example:
or something similar.
Seems that I have misunderstood something completely?!?!?
By the way. What do i need the “w”-component for when doing rotations???
Quaternions do not contain angles. They are magic 4 dimension numbers. Do not use them. Treat quaternion like a black box and leave it’s internal values alone.
99% of the time people think they need angles, they don’t. Why do you want the angles?
If you want the angles that the quaternion represents then use toAngles(). Like:
float[] angles = myQuat.toAngles(null);
…but this is likely to be unsatisfying because quaternions are a unique and compact form of a rotation and the angles might not be what you expect in all cases.
The long and short is start with the angles and set them yourself and create a quaternion from them when you need a quaternion to rotate a spatial.
float[] angles = new float[] { 0, 0, 0 } // my x, y, z rotation.
angles[1] = FastMath.HALF_PI; // rotate the Y axis by 90 degrees.
Quaternion myRotation = new Quaternion().fromAngles(angles);
mySpatial.setLocalRotation(myRotation);