I have a cube that I am successfully rotating by mouse drags with the following algorithm:
-
Initialize rotation matrix to identity
-
Multiply world-space y-axis (0, 1, 0) by inverted rotation matrix to get a vector in object space corresponding to the y-axis. Then rotate a bit around this vector given the mouse drags.
-
Same thing for x-axis.
-
Each update, apply rotation matrix to object.
This works fine, I am just having trouble understanding the theory behind why you can get the y-axis in object space by multiplying the y-axis in world space by the inverted rotation matrix. Can anyone explain this in very simple terms - I must be missing a key concept.
Thanks!