Tuesday 14 July 2009

Utility Nodes

Been trying to brush up on my already limited knowledge of the hypershade to help me get my head around this rigging lark.

Just had a bit of a breakthrough, so i'll put it into writing before i forget what i've done...

The example is from a tutorial on the rigging101 website (www.rigging101.com) and the goal is to add a unity node network to a sphere and a cube, so that when you move the ball, the distance the cube moves is the outcome of the equation.

So, the equation is;

pCube.translateX = (pBall.translateY * 1.5) + (pBall.translateZ / 2)

which means the value of the cubes translate x is equal to the balls translate Y multiplied by 1.5 PLUS the balls translate Z divided by 2;

ie. if the ball moves in the Y 5, the cube will move in the x 1.5*5 which equals 7.5 in the x direction.

The instructions on the tutorial were as follows;

drag the ball and cube from the output window to the hypershade, 2 nodes will appear.
drag 2 multiply/divide nodes over from the utility dropdown
drag a +/- Average node across
Connect the translate Y connector to the output 1x into one of the multiply/divide node
Connect the translate Z connector to the output 1x of the other multiply/divide node

Now this is where i ran into problems. The multiply/divide node is like the multiply divide buttons on a calculator. They do exactly the same thing. So any value input for translate y fed in goes into the multiply divide attribute. You then click on the attribute editor to tell maya what you want to do with it. In this case we are multiplying it by 1.5, so we input 1.5 in field 2x.

Now heres the tricky part. We're gonna get two values from the two sums, because we're calculating two equations, this is where the +/- Average node comes in. In the tutorial it says you can simply plug both multiply divide straight in giving them a sequential name (ie, 1,2etc), but for some reason maya doesn't offer that option (which seems strange because you can't do an addition with just one number).

I've emailed the guys who produced the tutorial, and had a look on some forums and found a solution;

When I linked the output from the Multiply Divide node, I had the MEL window open to see what the script looked like. I then copied that script, selected the other Multiply Divide, pasted it into the MEL window and executed it. Voilla! two connections to choose in the connection editor.

The only problem now is the equations don't appear to be working properly. When I tyranslate the sphere in the Y, say 5, the box moves 5 also - it should move 7.5?

Hopefully this is down to the way i've input the factor in the Multiply Divide node.

Rome wasn't built in a day!

No comments: