I have a system where we load objects into the scene. The following
operations are allowed. All inputs are given using mouse.
1. rotate individual objs
2. translate individual objs
3. rotate the entire system about the origin
4. translate the entire system
To do this, I keep the following data
And I do the following in the display function
foreach object i
1. apply rotation using quaternion Q
2. translate using parameters Tx,Ty,Tz
3. rotate using quaternion qi
4. translate to center using Cix,Ciy,Ciz
this seems to work fine for some transformations, but after certain
amount of rotation, I find that the objects move in opposite direction.
Can some one tell me what is wrong with my method? I would be glad to an
Please log in or register to post a reply.
depending on you’re applying your transformations [i.e. keeping the
rotated matrix] you could be applying what you may think is a controlled
angle but REALISTICALLY you’re applying a rotation on an already rotated
if you could be a bit more descriptive on how you’re applying the
rotations, that might help.
I found my mistake. I was unprojecting screen (window) co-ordinates to
object co-ordinates to find the axis of rotation for individial objects.
But this axis has to be mapped to the global co-ordinate system by
appling the inverse rotation matrix. This new axis should be used to
compute the quaternion for individual objects. Same theory applies to
any translations done to the objects.
good job! and thanks for reporting your findings - it’ll serve as a
reminder to pay attention to the stuff we may overlook by mistake.