### 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

| 168982 Views
| 3
Software used:
Keywords:

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.

## Creating the MELScript

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 continued on next page >

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

Building Exteriors in Cinema 4D - Part 1

by Dominik Dammelhart
published on 2012-11-14

Keywords: exterior, modeling, cinema 4d,

(5)
2 29237

Joan of Arc: Modeling of the Glove

by Michel Roger
published on 2009-12-17

Keywords: character, modeling, joan, arc,

(4)
0 37783

Modeling Gorilla Feet using Silo

by Josh Robinson
published on 2011-09-01

Keywords: modeling, gorilla, feet, silo, video,

(8)
0 6200

Making A Toon Character Called 'Geoff' & his Rig

by Tom Greenway
published on 2009-06-22

Keywords: character, creature, modeling, rigging, max,

(0)
0 52633