First Dip into MEL. Well... Not quite.

So I was looking into creating a nice arm twist that would work nicely with the smaller alien.  After trying it out first time I managed to get great results.  Finally!  An EASY thing to set up in rigging! Next to eye constraints. :P

Anywho, thought I'd share the code I put into the expression editor in Maya.

First I had to work out the rotation of when the wrist moves, how much the first part of the forearm would move; for now it was as follows;
L_forearm1.rotateY = L_Wrist.rotateY *0.75 ;
So to break it down it's just a bit of simple math.  The way Maya's expression editor works is like so
Therefore my little formula sounds more like this;
object.attribute equals to object.attribute multiplied by value
Sounding a little less complicated?  Well, basically I've found out that my equation is basically saying that the L_forearm1 object will rotate along the Y axis when the L_Wrist object rotates along the Y axis as well, at a multiple of 0.75, or a division of 3/4s but naturally it's easier to multiply a decimal than divide a fraction.

Testing this expression on, when I rotated my L_Wrist to 90 degrees, the L_forearm1 had a Y rotation of 67.5 degrees, showing the rotation has indeed been multiplied by the decimal (90 / 0.75 = 67.5)

Continuing with this succession, I then selected the L_forearm1 as the main object thus allowing the rotation Y to have some control over the next L_forearm2 bone.

L_forearm2.rotateY = L_forearm.rotateY *0.4 ; 
Instead of halving the 0.75 of the L_forearm1, I decided to drop down a unit to 0.4 as the rotation in the middle of the forearm is a little less than half.  Finally, I placed the following expression on the L_forearm3 joint for the finishing touch of the forearm.
L_forearm3.rotateY = L_forearm2.rotateY *0.2 ;
Thus completing the expressions for the wrist.  I can now move this onto the upper arms, thighs and shins.  I can't believe how simple this is!  Yey me! :D

No comments:

Post a Comment