Using Wire Parameters and Custom Attributes to move the eyes.
 

Step 1
Here's a nice trick if you want to add that extra bit of realism to your animations. The thinking behind it is that the eyes tend to rotate away from each other slightly when a person is looking at something very far away or just "zoning out", and rotate slightly towards each other when the person is looking at something very close, like reading a book.

First thing to do is select the helper object you're using to animate the eyes and then select Add Custom Attribute from the Animation drop down list. You don't want to add the CA (Custom Attribute) to the eyes themselves because that would defeat the whole objective of making animation as easy and efficient as possible.

Step 2
Now you'll see a window where you can set the parameters of the CA. Make sure you set it up the way you want it because the bad thing about CA's is that you can't easily go back and change them once you've hit Add.

Keep the Parameter Type at Float, and change the UI Type to whatever you like working with. Personally, I prefer the Spinner because it's easier to get back to the default setting by just right-click on it. Change the name to something that makes sense. Width doesn't really matter, unless you're name is really long or you just want to make it look all tidy. You can see a preview of the CA at the bottom of the window so you will be able to tell if you need to change this. The Range is very important. For this technique we'll be setting it at -1 to 1 with the default at 0. You can change it to whatever you want depending on your needs, but if you leave it at -1 to 1 it's easier to change the wiring if you need to. This will make sense in a minute.

Step 3
Make sure the CA is set up the way you want by looking at the Testing Attribute section. If it's okay then click Add.

Step 4
Now, we're going to wire the helper object to both eyes. That means we're going to make it so that the CA spinner will control the rotation of the eyes along one axis. So right-click on the helper object and select Wire Parameters.

Step 5
Navigate through the drop-down menus until you get to the CA you just created.

Step 6
And now, without clicking on anything else, select one of the eyes.

Step 7
There's a lot of menu navigating when you use wiring. So now navigate down the menus until you get to the Y Rotation axis. You need to have a Euler XYZ controller assigned in the Rotation slot in order to see the three separate axis like this. If you have Smooth, Linear, or TCB Rotation assigned then this won't work. Also, you want to select the axis that goes through the top and bottom of the eye so that it will rotate left and right. Depending on how you created your eyes it may be a an axis other than the Y Axis. Select your object with the Local Reference Coordinate System on to see which axis to choose. Don't worry, you can follow these steps again to rewire it if you need to.

Step 8
This is where the magic happens. A window pops up allowing you to wire the CA to the eyeball. Since, you want the CA to control the eye's rotation, and not the other way around, press the bottom Control Direction button. And now I'll break down the expression you see below:

degtorad - this tells Max to convert the number in parenthesis, which is the number of degrees to rotate the eye, to radians, which is the type of number that Max actually uses internally instead of degrees.

Eyes_In_Out - this is the name of the CA you typed in when you created it. Apparently Max changes dashes and spaces to underscores.

*10 - This is the multiplier used. This can be changed to make the eyes move more or less, depending on what you need.

Basically, this formula is telling Max to take the number in the CA spinner (or slider) and multiply it by the number at the end of the formula (in my case, 10). Then it tells Max to pass that number onto the eye and rotate it by that much. So, for example, if my spinner is at 1, then it's going to turn the eye 10 degrees (1*10=10). Or if it's at -.5, then the eye will turn the opposite direction 5 degrees (-.5*10= -5). In this case, then, the maximum my eye will turn is 10 degrees. If you want it to turn farther just increase the last number to whatever you want the maximum to be.

Step 9
Now go back to Step 4 and repeat for the other eye. The only difference is to change the number 10 in the final step to a -10. This way the other eye will rotate in the opposite direction.

Step 10
At this point you should be able to move the slider or spinner in your helper object and watch the eyes rotate toward and away from each other.

This is a subtle effect to use when you're animating and is one of those extra touches that can bring more life to a character. And the combination of Wiring and Custom Attributes is very powerful and a good way to animate many things at once. Another way to accomplish the same thing would be to use a Reactor controller on the eyes, but I'll cover that later.

Click here to learn about more advanced techniques...

Click here to go back to the "Eyes" page...