1. 3D & Motion Graphics
  2. Maya

Animating Wheels Automatically in Maya Using the Power of Expressions


Hey guys, today I will show you how to animate a Cart's Wheels using Expressions in Maya. This is a follow up tutorial of my previous tutorial "Wheel Rotation In 3ds Max Using Parameter Wiring". This time I am showing how to achieve the same result in Maya and I hope Maya users will find it helpful.

Step 1

In this Maya tutorial, we’ll learn to animate a Trolley/Cart's Wheels using Expressions. The best part is that we don’t need to animate the wheels. We’ll animate the Trolley only, and the Wheels will animate and move automatically. I have created a basic model of the Trolley already. So open the "Start Trolley.mb" file first which is supplied with the tutorial.

Step 1 Image

Step 2

Before starting, let’s go through the Trolley parts. So first open the Outliner window to navigate the object list. To open the Outliner window, click on the Window menu and then select Outliner.

Step 2 Image

Step 3

You can see there are three major parts of the Trolley listed in the in the Outliner - Handle, Body and Axle.

Step 3 Image

Step 4

Select the Handle group and you will see these are separate from the other parts.

Step 4 Image

Step 5

Select the Body group and you will see all wooden planks and nails are attached together, but not connected with the other parts.

Step 5 Image

Step 6

Select the Axle group and you will see both of the wheels and the axle in this group. So before starting to rig the Trolley, we have to make some special and essential arrangements first.

Step 6 Image

Step 7

So let’s start with the Handle group first. Select the Handle group and then press the “Insert” key on the keyboard and you will see its Pivot point.

Step 7 Image

Step 8

Now, with the Body part selected, press the “Insert” key and you will see its Pivot point in the middle. It could be anywhere. However we don’t really need to change it because the Body has to be linked as a Child with the Handle.

Step 8 Image

Step 9

The Axle group is showing the Pivot point at the center of the Wheels, which it is quite right for rigging it properly.

Step 9 Image

Step 10

Now, we will do some parental linking. So first select the Body, then press and hold the Shift key and then select the Handle part and finally press P.

Step 10 Image

Step 11

This makes the Body a child of the Handle. Now wherever the Handle goes, the Body will follow.

Step 11 Image

Step 12

Now we will create the Expression for the Rotation of the wheels. So select the Axle part and in the Channel Editor, select the Rotation X transform attribute because the wheels would rotate in the X-axis in this case.

Step 12 Image

Step 13

With the Axle and its Rotation X transform attribute selected, click on the Edit menu of the Channel Box and select the Expressions... command in the drop down menu.

Step 13 Image

Step 14

The Expression Editor window opens. You will see the Axle is selected in the Objects group, while Rotation X is selected in the Attributes group.

Step 14 Image

Step 15

In the Expression Text box, write this expression (Axel.rotateX = Handle.translateZ*20;) and then click on the Create button. This Expression says that when the Handle moves in the Z axis, the Axle will rotate the 20th part of the translation. Instead of the value 20, you can check with other values like 30, 40 etc. Actually this value will control the speed of the rotation, so I suggest playing with this value until you get the desired speed of the rotation.

Step 15 Image

Step 16

Now, we will connect the Axle to the Handle part, but before that we’ll create a Locator first. So click on the Create menu and then select Locator. The Locator is created on the grid.

Step 16 Image

Step 17

Place the Locator near about the Axle as shown in the image below.

Step 17 Image

Step 18

First select the Axle part, then select the Locator and press the P key. Now the complete Axle part (with wheels) becomes the child of the Locator.

Step 18 Image

Step 19

Finally select the Locator, and then select the Handle part and again press the P key. Now this makes the Locator the child of the Handle. This way, the Handle becomes the parent of all the parts.

Step 19 Image

Step 20

Now, select the Handle and drag it in the Z axis. You will see the Wheels also rotate and follow the Handle. You can now make the animation as you want. And the best part is that you only have to animate the Handle and rest of the things will follow it automatically with the rotation of the wheels too.

Step 20 Image

Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.