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.â
Because thatâs for STORING THE RESULT. Not passing whatever you want. It is physically/mathematically/whatever impossible to turn a quaternion into a single rotation around âwhatever axis you wantâ.
I hate repeating myself so I recommend you actually read my previous post.
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"
Yep, which is why itâs important to treat the quaterion x,y,z,w as unfathomable magic values. To use quaternions, you definitely do not need to understand them.