Expression based Dynamic Rig: Create Game-like Saw Blade Rig in 3ds max

Creating an Expression based Dynamic rig of a Game-like Saw Blade (just like Prince of Persia).

Hi! In this tutorial, we are going to create an advance and automated expression based dynamic rig setup of a Prince of Persia game-like saw blade in 3ds max. The rig is fully controllable and the movement of the saw is controlled by a float expression controller using some math. I recommend some basic knowledge of Animation Controllers before getting into this tutorial. Let’s get started.


Step1

Here, I have a saw blade geometry with it’s “z rotation” controlled by it’s “x position” so whenever we move it on the x-axis, it starts rotating around it’s z-axis. This can be done either by using simple math or by wiring (Read this post to learn more about wiring).


Step2

Now, I have to make the blade geometry to bounce or oscillate between the two points. This can be easily done by using some math.

(1+sin (200*S))

If I assign the above given expression to the x-axis of an object using Expression controllers then it will start oscillating from one point to another. (See Image)

The formula works quite good and we will use the same formula to oscillate our saw blade geometry.

Note: The Original formula is (1+sin(360*Time)). I just modify the formula to show that you can also edit it according to your need.


Step 3

expression based dynamic rig

Whenever you assign the given expression to any of the axis of your object, the object will automatically jumps to the coordinate having value “1” of that axis. This is due to the numeric “1” that we put before sin in our formula. Your object will jump to the same coordinate value that you put before sin in the formula and if you put nothing then your object will jump to the zero coordinate of that axis. So no need to worry if your object changes the position while evaluating the expression.

Note: I highly recommend putting 1 before sin in the expression instead of using any other numeric value to avoid some offset issues.


Step 4

expression based dynamic rig

The formula works fine but we have to modify it in order to make it more flexible for use. Let’s have a look at some more elements of the formula.

(1+sin (200*S))

Where 200 is the speed of the oscillation and S is seconds. Instead of using the value 200 for oscillation speed we will use a variable to control the speed or the number of oscillations per unit time. After modification the expression would be:

(1+sin (speed*S))

Where speed is a variable controlled by a slider/spinner so that we can easily adjust the speed by adjusting the value of the slider/spinner.


Step 5

expression based dynamic rig

If you notice, the oscillation of our object is very short so in order to raise/increase the amplitude of the oscillation of our object we can probably multiply a suitable number to the whole expression or we can use a variable assigned to a spinner or slider control, instead of any number (see Image). This is an either way to adjust the amplitude of the oscillation but we will use another way to control the amplitude of the oscillation.


Step 6

expression based dynamic rig

During Oscillation, our object moves from one point to another and if we increase the amplitude of the oscillation the distance between those points also increases. I want to make these points easily adjustable so we have to put some more elements to the expressions. We will be using two point helpers i.e Point A and Point B as those two points.

(1+sin (Speed*S)) * (Position1 – Position2) + Position2

Where Position1 is the position of the first Point A helper and Position2 is the position of the Point B helper. Subtracting Position1 and Position2 vectors gives the vector between Point A and Point B and adding “Position2” to the expression will put the object between these two points correctly.

Implementing the formula


Step 7

expression based dynamic rig

Let’s put it into action. First make two point helpers and name them Point A and Point B respectively. Select Point A helper and add Attribute Holder modifier to it. Now, go to Animation > Parameter Editor…(Alt+1) to bring up the Parameter Editor Dialog. Under Add to Type group, choose Selected Object’s Current Modifier option. Name your attribute as Speed. You can choose UI Type and Range according to your need. I am using Slider as UI Type and using range from 0 to 1000.


Step 8

expression based dynamic rig

Now, select the object you want to oscillate between these two point helpers. Go to Motion Panel, select the position track then click on Assign controller button and choose Position Expression from Assign Position Controller dialog and hit ok.

Note: Here, I am assigning the Expression Controller to the Position Track of the object so that all the three axes will affected by the expression but if you want any single axis to be controlled by the expression then select that particular axis and assign Script Controller to it instead of using Expression Controller.


Step 9

expression based dynamic rig

Now, create two vector variables Position1 and Position2 and assign them to the position track of Point A and Point B helper respectively by making use of Assign to Controller button. Make a scalar variable Speed and assign it to the Speed slider control that we recently added to the Point A helper. Under Expression Field, write down the expression (1+sin (Speed*S)) * (Position1 – Position2) + Position2 and click on Evaluate button. Now check the setup.


Step 10

expression based dynamic rig

Notice that the oscillation of our object is going just double the distance between our two point helpers. To fix this problem just select your object and double click on the Position Expression track to bring up the Expression Controller dialog. Now divide the (1+sin (Speed*S)) by 2 so the new expression would be:

(1+sin (Speed*S))/2* (Position1 – Position2) + Position2

Click on Evaluate button and close the Expression Controller dialog. Now it’s all ok with our object. Now our object will move in between our point helpers and you can also control the speed of the object by Speed slider control.


Step 11

expression based dynamic rig

One last thing to do is to LookAt Constraint our saw object and Point B helper to Point A helper. So go ahead Select both the objects (saw and Point B helper) then go to Animation menu > Constraints > LookAt Constraint, now click on Point A helper to add it as a Look at target. Now, the setup is completed and ready to use.

I hope you enjoyed this tutorial and learned something new from it. You can use this technique for various setups depending upon your creativity. For your problems and feedback just email me or leave your comment in comment section.