[Closed] How To Script a Mirror Mirror Pose Tool?
I’w been trying to come up with a miroor pose tool… but i cat seem to fibure out hov to make it. I have been told that I should lock at the matrix but… i dont undre stand how I can use it…
Take if i have a IK on my arms… I only know how to mirror in the wold coordinate system… but if i turn the character around it seem to mess it up…
Do anybody have a script for mirroring a pose or parts of a rig?
The best method is with the matrix. I suggest that you get Bobo’s DVD from http://cg-academy.net call Advanced Maxscript 1, The Matrix Explained. Bobo as always does a fantastic job of explaining the ins and outs of vector math and goes as far to write a ray trace rendering engine using Maxscript.
If you have access to max 8 discs I created a character that is in the samples directory called Maxine. She has a mirror pose system built in that using the matrix to do the calculations.
ill have a another look at that dvd… and il get the max8 cd’s from work…
thanks alot Paul… much appreciated =)
I forgot to mention that my mathLib on my site has a function for mirroring matrix values. It is used like…
penMath.mirrorMatrix axis:“x” flip:“z” tm:$theObject.transform pivotTm:(matrix3 1)
It returns a matrix that has been mirrored around the pivotTm.
Check out this post from a couple months ago http://forums.cgsociety.org/showthread.php?f=98&t=578183&highlight=mirror
I was wanting to do the same thing you are, and I had gone through the DVDs myself, but after a weekend of beating my head against the wall, I just couldn’t understand the concepts and I finally asked for help. Bobo explained it enough that I finally got over the hump.
As I understand it, you’re basically flipping two of the three axis, and which of the two you flip will depend upon what axis you’re mirroring around, and the specific heirarchy of the objects in question. I still don’t understand it beyond that, but it’s enough that I can use it now!
The problem being that people think of the axes as rotations, they are not, they are vectors that point in the direction.
Matrix3 x_Vector y_Vector z_vector position
or
matrix3 [1,0,0] [0,1,0] [0,0,1] [0,0,0]
That is an object that is aligned to world in position and rotation and hasn’t been scaled.
The frist three vectors are unit vectors or normalized vectors and the position is the world position of the object.
The x_vector in this case points along the x axis, the y along the y and the z along the z. If you were to rotate the object 45 degrees around the Z axis it would look some thing like this.
matrix3 [.707,.707,0] [-.707,.707,0] [0,0,1] [0,0,0]
So to mirror the matrix above with the x flipped around the world you would get.
matrix3 [-.707,.707,0] [.707,.707,0] [0,0,1] [0,0,0]
Now the problem is you have a left handed transform and not right handed. In other words you have scaled the object to a negative value along one axis.
You need to remirror it around its own axis to remove the scaling. If you want to know what a right handed matrix is hold out your right hand like you are making a finger gun and then extend your middle finger at a right angle to your index finger. You index finger is x, middle finger is y and your thumb is z. Do the same with your left and and you have a left handed matrix.
Thanks alot both of you… its been a great help… Its been hard trying to figure out this and i appriciate your help… and paul ill have a look at the maxine rig when i got the max cd*s from work =) thanks alot again
You need to remirror it around its own axis to remove the scaling
Paul, would you mind showing how you do that last step as well?
You mean mirroring it back?
–Create a point
p=point pos:[-20,0,0] size:20 axistripod:true box:true
–Rotate it 90 in z
rotate p (eulerAngles 0 0 45)
–Get the transform matrix to work with.
tm=p.transform
–Mirror the tm across the world matrix in x
mirroredTm=tm*(scaleMatrix [-1,1,1])
–Set the transform just so you can see what it has done.
at time 10
animate on
p.transform=mirroredTm
–Mirror the mirrorTm in local space but this time on the y axis. This would be known as flipping the y.
finalTm=(scaleMatrix [1,-1,1])*mirroredTm
–Set the transform back to the object.
at time 20
animate on
p.transform=finalTm
I just updated the script so that it is animated. Just for the fun of it and so you can see what it is doing.