Quaternion assignment

Hey guys,

short question about some code i dont understand why it outputs what it does:

Quaternion rotation = new Quaternion();
float value = (float) (Math.random() * 2 * Math.PI);
rotation.fromAngleAxis(value, Vector3f.UNIT_Y);

Those are some output examples:

(0.0, 0.17560631, 0.0, 0.9844605)
(0.0, 0.7497299, 0.0, -0.661744)
(0.0, 0.29882073, 0.0, -0.9543093)

I dont understand why the quaternion doesnt contain the value i assigned, could anybody help me with that? Thanks in advance.

But it does. Why do you think it doesn’t?

Or… wait… are you actually trying to read the values inside of a quaternion have them make sense. (Easier to put your head through a wall and about as useful.)

value is an angle (presumably)

Quaternion is a rotation.

Like apples and oranges.

If i assign the quaternion to an object now, it isn´t rotated randomly, but thats what i want it to do?
I thought the quaternion stores the angles from 0 to 2*Math.PI. Maybe i am wrong with that

100% wrong on that.

Quaternion stores a rotation in 3D space. An angle at best is a rotation in 2D space. Do not try to understand the values of the quaternion. They are effectively magic.

Your output looks right to me. Three different random quaternions.