InitLocation rotation = -40.514233
Player rotation = -40.514233
player is a VehicleControl type
I’m just rotating a model around the Y axis. I don’t understand why I don’t get the same rotation printed out as I put in (-90 degrees).
I’m really starting to believe we should rename Quaternion’s x,y,z,w to something like giraffe, jello, green, and bloop. Then maybe people will stop thinking they understand what these mean.
If you want “rotation around some axis” then use toAngleAxis(). Recognize that it is giving you an angle AND an axis… and that may not be the axis you gave it initially. Probably… but you can’t necessarily count on it. Euler angles are ambiguous but quaternions are not.
You can use toAngles() which will tell you rotations around the x, y, and z axes… but you may see rotations appear in those other axes.
If you must track rotation around the y axis then you need to keep rotation around the y axis and convert it to a quaternion only when you need to apply it to a spatial. You can’t expect to get that same value back out of the quaternion again later.
Perhaps too similar and then someone will read something into them. (So ‘abracadabra’ and ‘hocuspocus’ must be my x and z since they are related and then ‘flyingUnicorn’ must be y because it goes up and down…" Two magic incantations plus a magic creature. I see you are trying to be ‘magic’ but I’m trying to be completely nonsensical.
Though, mine only works if you don’t know the joke “How many surrealists does it take to change a lightbulb?”
(Answer: “Two. One to hold the giraffe and the other to fill the bathtub with green jello.”
I did actually read your post and I thank you for your suggestions which I will now attempt to implement. Now I know that you can’t get out of a Quat what you put in I’ll use your suggested approach, and thanks for your advice.
Can you point me to any literature which will give me a better understanding of this subject ?
Not sure. I no longer remember where I picked up what I know… but you might read about the relationship between Euler angles and Quaternions. Potentially do a few thought experiments about what it means that “Euler angles are ambiguous”. And you can search for similar forum questions because this same topic just came up last week… though I think the magic words I used for the quaternion values were different.
Bottom line: for any given orientation there are exactly two Quaternions and one is just an inverse of the other.
For that same orientation, there are infinite number of Euler angle combinations that will produce that orientation.
How about adding to the javadoc the first line @pspeed
If you reading this, you won’t understand this, so just use the methods offered, and stop thinking what the fields actually mean. (But if you are interested they are a 3 dimenional projection off a 4dimensional spheric entity that has 2 imaginary components), see? you dont understand, so stop pretending to be"