How to automate the Animation using Expressions in 3ds max?

A tutorial guide to learn how to use simple mathematical expressions along with the Expression Controller to automate the animation in 3ds max.

In this tutorial, I will be showing you how to automate the motion of an object using simple expressions in 3ds max. We will be looking at some simple expressions and their usage with the expression controller to achieve three different types of rotations but you can use these tricks with object’s position and scale if you want.

Beginners can take advantage of these helpful expressions to animate the simple objects, for example windmill, rather than hand animating them. Below is the small demo of what we are going to create in this tutorial.


So, let’s get into it.

Rotation with Constant Speed


Step1

Assigning the Controller

Here, I have a gear geometry in the scene for the demonstration. Select the object then go to Motion panel and select the Y Rotation track from the Assign Controller rollout.

Now, click on the Assign Controller button to launch the Assign Float Controller dialog and select Float Expression from the list and click OK.


Step2

After choosing the Float Expression from the list, Expression Controller dialog will pop up. Under Expression field, write down 5*S, click on Evaluate and close the dialog.

S stands for seconds in the expression.Click on Play button to see the object rotating at its Y axis.

The Expression Controller

We can also connect the expression to the spinner or slider for better control over the rotation speed without reopening the Expression Controller dialog every time. Let’s do it in the next step.


Step 3

Select the gear and apply an Attribute Holder modifier to it from the Modifiers list. Now, we have to add a custm attribute to our object so lets open up the Parameter Editor (Alt + 1) from the Animation menu.

Adding Custom Attributes

Under Parameter Editor dialog, set the Add to Type to Selected Object’s Current Modifier. Name your parameter as Speed and set the UI Type to Slider or Spinner.

Set the Range from -20 to 20 with Default value of 5. Now, click on Add button to add the parameter to the object.


Step 4

With the gear object selected, go to Motion panel and double click on the Y Rotation track to open up the Expression Controller dialog.

Assigning Variable to the Controller

Under Create Variables group, create a scalar variable and name it Speed. After creating the variable, click on the Assign to Controller button and assign it to the Speed parameter of the Attribute Holder. One Last thing is to change the expression as Speed*S.

Now, you can easily control the rotation speed of the gear through the spinner control.

Progressive Rotation

Editing the Expression

For progressive rotation, we have to do a very little change in the existing expression. Go to Motion Panel and double click on the Y Rotation track to reopen the Expression control dialog and change the expression to:

Speed^S

It’s the Speed variable with S as exponent so, increase in Time (S) will also increase the rotation speed.

Two Way or Two Directional Rotation

Two Way Rotation Expression

This rotation is a bit complex as compared to rest of the two rotations. We want the gear object to rotate in both directions (clockwise and counter-clockwise). To achieve that behavior we will be using the Sine function in the expression.

so, let’s open up the expression Editor once again and feed the expression given below.

2*sin(100*S*pi)

Where S is Time in seconds, 2 is the amplitude and 100 is speed value.

Click on Evaluate button and check the effect by playing the animation. You can notice that the object has started rotating clockwise and anticlockwise at some angle in the Y axis.

You can replace the amplitude and speed values with variables and connect them to a slider or spinner control. Here is the object with amplitude and speed variables connected to the spinner.

I hope you enjoyed this tutorial and learned something new. Use your creativity and implement these little yet handy expressions to drive your animations. Thanks.