Suppose I have an Arcball camera that rotates up/down and sideways based on mouse input. After doing some research, I discovered that the correct way of calculating the new orientation is to do it the following way
// qy is a rotation (in quaternion) around the y-axis
// qx ~ around the x-axis
Quaternion orientation = (qy * old_orientation * qx);
However, I am not sure why switching the order of qx
and qy
introduces unwanted roll.
One answer from this post brushes on the subject.
The answer stated and I quote
When working with Quaternions, order does matter, as it always does with 3D rotations. In my example, "Direction *= newRotation" is the same as "Direction = Direction * newRotation". But, with left and right rotations, we want it the other way around. This makes it not dependent on the up and down tilt, which causes roll.
Based on my understanding, orientation
does the complete opposite of what they described. qy
depends on qx
since we apply qx
to some vector first. What did I miss or what did I misunderstand?