PDA

View Full Version : Mirroring rotations

 Jon-Huhn12-31-2007, 04:27 AMI know this has been asked several times on this forum, including http://forums.cgsociety.org/showthread.php?f=98&t=310161&highlight=mirror and http://forums.cgsociety.org/showthread.php?f=98&t=345187&highlight=mirror , and I've even gone through Bobo's Matrix DVD a few times. However this kind of math comes hard for me and I have yet to really understand the principles involved enough to mirror a rotation across a mirror plane myself. I've seen a reference to the Maxine rig Paul Neale did that was included with the Max 8 installation, however I don't have access to those disks anymore now that we're on Max 2008 so that's not much help. Can someone either 1) help me work through the mirror issue or 2) show me where (and IF) I can obtain a legal copy of that Maxine rig so I can dissect the mirror feature included? Thanks so much for your help in advance.
Bobo
12-31-2007, 05:17 PM
Hi Jon,

Rotation controllers operate in parent space. Thus, all you need is taking the value stored in the source rotation controller, multiplying the quaternion value by a matching mirror matrix and outputting the result as the value of the target rotation. This would work even if both objects are linked (typically to the same parent).

For example:

*Create a Teapot.
*Copy it and offset to the side along the Y axis - both a loking in the same direction with their spouts
*Create a Box
*Link both Teapots to the Box
*Assign a Rotation Script controller to the Rotation track of Teapot02
*Create a variable theSource in the Script Controller
*Assign the Rotation track of Teapot01 to theSource variable
*Enter the code

theSource * matrix3 [-1,0,0] [0,1,0] [0,0,-1] [0,0,0]

in the Script field and Evaluate - this will mirror both X and Z and leave Y as is.
Rotate Teapot01 with the Mouse - Teapot02 should follow the rotation, but mirrored. Rotate the Box with its children and try to rotate Teapot01 again - the rotation of both is in parent space, so the orientation of the Box should not affect how the script calculates the mirrored rotation.

If you like to assign the Node track instead of the Rotation track as the source variable, the expression would be

theSource.rotation.controller.value * matrix3 [-1,0,0] [0,1,0] [0,0,-1] [0,0,0]

because theSource.rotation would return the quat in world space, while the above cases both get the rotation in parent space, as stored in the rotation track's keys / values.

Hope this helps.

Jon-Huhn
12-31-2007, 07:31 PM
Bobo,

Thanks so much for your help. I'll need some time to digest this new information in light of what I thought I already knew, but this may be the missing instruction that I needed.

Thanks!

Jon-Huhn
01-01-2008, 04:49 AM
Bobo,

Doesn't this technique you've described put the dreaded negative scaling on the object? Isn't that why we avoid usin the mirror tool?

Bobo
01-01-2008, 11:28 AM
Bobo,

Doesn't this technique you've described put the dreaded negative scaling on the object? Isn't that why we avoid usin the mirror tool?

Nope!
We are "scaling" the rotation portion of the transformation only. So the quaternion value is mirrored, not the transformation matrix of the object. This is because we operate on the rotation track only, not on the higher-level transform track.

CGTalk Moderation
01-01-2008, 11:28 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.