Rigging a Pendulum in 3ds max using Mathematical Expressions

A detailed tutorial on how to create a Pendulum rig in 3ds max using a mathematical expression with fully automated Amplitude, Frequency and Decay controls.

In this tutorial, I am going to show you how to rig a pendulum in 3ds max with the help of Expression Controller. It’s a very simple, automated rig in which you can easily tweak the motion of the pendulum with the help of some controls without messing with keyframes. This tutorial involves creating a basic pendulum geometry, using a very simple expression to achieve the pendulum motion and creating slider / spinner controls to control the amplitude, frequency and also the decay of the pendulum, so, let’s get into it.


Step1

create pendulum rig in 3ds max

Let’s first create our basic pendulum geometry. Here, I am creating a very simple pendulum by assembling two simple primitives together but you can also use any detailed object for sure.

Go to Modify Panel » Create Panel and create a box as shown in the image and set its pivot point at its top.


Step2

create pendulum rig in 3ds max

Create a cylinder and align it to the box as show in the image. Now, select the cylinder and link it to the box using Select and Link tool so that whenever the box will move or rotate, cylinder will follow the box.


Step 3

create pendulum rig in 3ds max

Now, select the box and go to Modify Panel » Motion Panel. From Assign Controller rollout, expand the rotation List and select the Y Rotation track.


Step 4

create pendulum rig in 3ds max

Click on Assign Controller button to bring up the Assign Float Controller dialog. Select Float Expression from the list and click OK to close the dialog.


Step 5

create pendulum rig in 3ds max

Under Expression Controller dialog box, create two scalar variables and name them ampl (for amplitude) and freq (for frequency) respectively.


Step 6

create pendulum rig in 3ds max

Now, Select the ampl variable from the Scalars listbox then click on Assign to Constant button and set its scalar value to 1. Do the same thing with freq variable and set it’s scalar value to 75.


Step 7

create pendulum rig in 3ds max

Now, Under Expression Controller dialog box, write down the following expression in Expression Group text field.

ampl*sin(freq*S*pi)

Where S is time(secs), ampl is the Amplitude and freq is the frequency of the oscillation.
Using the above expression you will get something like this:


Step8

create pendulum rig in 3ds max

Let’s modify the formula and add some decay to the movement of the pendulum, so create another variable dec (for decay) and set it’s scalar value to something like 0.5. Now, modify the formula as shown below.

ampl*sin(freq*S*pi)/exp(dec*S)

The existing formula is divided by exp(dec*S). Here, exp stands for e (constant) raised to the power (dec*S)
Note: In 3ds max e is a constant having value 2.71828


Step 9

create pendulum rig in 3ds max

Let’s make some controls to control the frequency, amplitude and the decay value of the pendulum, but first we have to create an object which will hold all these controls. So, go to Create Panel » Shapes and create a small circle from there. Go to Modify Panel and under Rendering rollout just turn on the Enable in Viewport option. You can name it as Master_object or whatever you want.


Step 10

create pendulum rig in 3ds max

Align the circle to the pendulum as shown in the image and link the pendulum to the circle. Now, with the circle selected, go to Modify Panel and apply Attribute Holder modifier to it from the modifier list.


Step 11

create pendulum rig in 3ds max

Let’s add some custom attributes (slider / spinner controls) to our master object so just select the master object and press Alt+1 to bring up the Parameter Editor dialog. Under UI Type rollout, select the spinner or slider, whatever you want your control to be and name it Amplitude. Click on Add button when you are done.
Now, create two more, similar controls using the same process and name them Frequency and Decay respectively.


Step 12

create pendulum rig in 3ds max

Now, we have to connect these slider or spinner controls to the variables that we have created under Float Expression dialog so that we can easily control the value of those variable through these controls.
Select the cylinder, then go to Motion panel and double click on the Y Rotation track to bring up the Expression Controller dialog.


Step 13

create pendulum rig in 3ds max

Select the ampl variable from the Scalars list box then click on Assign to Controller button to launch the Track View Pick dialog. Now, search for the Master_Control and collapse it to reveal some more tracks. Expand the Modified Object track, go ahead and collapse it until you get the Custom Attributes track. Under Custom Attributes track, you will find some attributes that we have added through Parameter Editor. Select the Amplitude from there and click on OK button when you are done. Now, click on Evaluate button and test the amplitude attribute.


Step 14

create pendulum rig in 3ds max

Now, you can easily control the value of the amplitude variable directly through the amplitude Spinner control. Let’s connect the rest of the controls with using the same process.

Step 15

We are done now. Here is the final pendulum motion. The left one is without decay and the right one is with the decay value of 0.5.

I hope you enjoy reading this tutorial and learn something new from it. For your queries and suggestions simply email me or leave your comments below. Thanks.