Lesson 3: Expressions
Expressions
Expressions
are useful tools in Autodesk Maya to make specific changes to an object.
“Expressions are program-like instructions you create to control keyable
attributes over time. Expressions can be comprised of mathematical equations,
conditional statements, or MEL™ commands (Getting Started in Maya, 2010, 625).”
MEL stands for Maya Embedded Language, and it is not hard to learn. The
“keyable” attributes are those like translate, rotate, and scale. Expressions
give way to more complicated steps than just following a driver object.
Let us say there are two gears that you would like to turn, gearA and gearB. You would
like it to look like gearA pushes gearB, but an Orient Constraint will not
allow you to make the rotation look right. The reason the gears do not look
right is due to the fact that they share the same rotation values, and thus
looking like wheels rather than gears. If you go into the Expression Editor and
write an expression saying that the rotation in the axis you need of gearB is
equal to the rotation of the same axis of gearA times negative one, then you
will see a much more realistic set of gears.
Making a Set of Gears
Using an Expression:
Step 1: Make a
Polygon Cylinder. Go to the Create Tab à
Polygon Primitives à
Cylinder
Step 2: Make the
Menu set to Polygons by selecting it from the drop down menu.
Step 3: Right
click over the cylinder, and use the Faces selection mode. Select ever other
face on the cylinder.
Step 4: Extrude
the faces. Go to the Edit Mesh Tab à
Extrude
Step 5: Hit the Q button and then hit the R button to scale
the extruded faces to your liking.
Step 6: Name the gears, and then go to the Window Tab à Animation Editors à Expression Editor
Step 7: Type in the window similar to the following. Hit the
Create button and try it out.
References:
(2010).Getting Started in Autodesk Maya 2011. Autodesk , Inc.