### Keep up-to-date with Free tutorials!!

Sign me up to receive third-party emails from 3dtotal's partners, too!

- Latest news
- Exclusive Shop Offers
- Preview early content
- Plus much more

Not Ready to take that step? OK, Why not just Subscribe to the RSS Feed

1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
Modeling, Scripting and Animating Gears

By Chris Shaw
| 147523 Views
| 3
Software used:
Maya

You're now ready to start animating.

## Animating the Gears

The objective of this tutorial is to create a simple Gear system that is simple to animate and easily modified. It would be far too tedious and time consuming to keyframe the rotation of gear01 - gear05 + TranslateY of door. It would be even more tedious to modify it several times if your supervisor required it.

For that reason, we'll create a system that only requires the animator (you) to animate gear01.
Select gear01 and create the following 2 keyframes (Fig.30).

Fig. 30

Play the animation and check that gear01 rotates 10 times.

MELScript is the programming language used in Maya. An expression is a MELScript that runs every frame and allows you to create animation.

The next step is to write a MELScript that calculates the rotation value for each gear (gear[2] - gear[5]). We'll start by creating and explaining the MELScript first, and then show you how to use the Expression Editor later in the tutorial.

## MELScript for gear02

In Fig.31, cog10 is paired to cog20. When cog10 is rotated, cog20 will rotate at 1/2 the speed.

Fig. 31

This can be summarized as a ratio: cog10/cog20=0.5 (10/20=0.5). The MELScript to rotate gear02 by 1/2 the rotation value of gear01, in the opposite direction is:

gear02.rotateX=gear01.rotateX*-0.5;

## MELScript for gear03

In Fig.32, cog10 is paired to cog40. When cog10 is rotated, cog40 will rotate at 1/4 the speed.

Fig. 32

This can be summarized as a ratio: cog10/cog40=0.25 (10/40=0.25). The MELScript to rotate gear03 by 1/4 the rotation value of gear02, in the opposite direction is:

gear03.rotateX=gear02.rotateX*-0.25;

## MELScript for gear04

In Fig.33, cog20 is paired to cog30. When cog20 is rotated, cog30 will rotate at 2/3 the speed.

Fig. 33

This can be summarized as a ratio: cog20/cog30=0.66 (20/30=0.66). The MELScript to rotate gear04 by 2/3 the rotation value of gear03, in the opposite direction is:

gear04.rotateX=gear03.rotateX*-0.66;

## MELScript for gear05

In Fig.34, cog10 is paired to cog30. When cog10 is rotated, cog30 will rotate at 1/3 the speed.

Fig. 34

## < previous page next page >

1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
Related Tutorials

Tutorial

Gallery Image.

Keywords: modeling, human, anatomy, eyes,

(2)
0 4508

Tutorial

Gallery Image.

Keywords: modeling, texturing, modo, portrait

0 31060

Tutorial

Gallery Image.

Keywords: Maya, ZBrush, Modeling, Character

2 27496

Tutorial

Gallery Image.

Keywords: Arch-viz, 3ds Max, snow, modeling

1 26856