Free 3d tutorials: from 3d tips & tricks to advanced 3D software tutorials in 4 seconds.

Tank rig tutorial

THE SPINNING EXPRESION


We’ll need a mathematical expression in the wheel’s x-rotation controller. In this expression we need to find the x-rotation value regards the distance traveled by the tank. I could give you the expression and you could use it without knowing how it was made, but i won’t be a good teacher if you make it so easy!………

Seriously speaking, It’s better that you start understanding how to make expressions for future rigs challenges. So, here we go, a small and very easy mathematical lesson:

How can we find the wheel’s x-rotation?. Think about the distance that a circumference needs to travel to make a full turn. This distance is equal it’s perimeter (2*pi*radius).

To find the numbers of turns along a distance, we could take this distance and divide it by the distance traveled by one turn (as mentioned before, one turn is equal the perimeter). For example, if we have a distance of three times the wheel’s perimeter, dividing the first value over the perimeter wil give us a number of 3 turns.

And what do we do next with the turns number?. We could multiply it by its equivalent in degrees, 360º or 2*pi in radians, and we got our expression!.

This expression goes as follows:

(Distance / (2*pi*Radius)) * 2*pi

Actually, we may cancel the (2*pi) values by themselves. 2*pi / 2*pi is equal one (1), so we can remove these numbers, they’re irrelavant now.

We got: Distance / Radius.

And what about the distance? how can we find it?. we could do it using the percent along path of the path constraint, and the path’s length. One value by the other will give us what we wanted: Distance=(Percent/100)*SplineLength, we divide Percent by 100 because here we need a percent that goes from 0 to 1. when the percent is 0% the distance is 0, when the percent is 100% the distance is equal the Spline’s Length. 50% will give us a half of the spline’s length, and so…

Finally the expression goes as follows: (Percent/100)*SplineLength / Radius.

Now, we’re gonna put this expression in the wheel’s x-rotation controller, we’ll be using the script controller.

Select the wheel, in the Motion Panel open the Assign Controller rollout, select the Rotation: Euler XYZ Controller and click in the assign controller button , select Rotation List. With a list of rotations we may have 2 controller layers, one for the script and the other one for manual adjustments. Open the rotation List, in the Available controller assign an Euler XYZ controller, this controller is for manual adjusment, so we need to set it active double clicking it in the Rotation List rollout, or by clicking the “Set Active Button”. When a controller is active this one will be the one that we’ll be modifying by the rotation gizmo (manual adjustment).

Go back to the first Euler XYZ controller in the Assign Controller Rollout, open it, in the x-rotation controller assign a float script controller.

In the Expression Text Box write: SplineLength=curveLength Path, this line enables us to get the path’s length using the curvelength maxscript function (it doesn’t work well if the path spline is scaled). In the next line write the expression, (Percent/100)*SplineLength / Radius.

Pages: 1 2 3 4 5 6 7 8 9 10 11 12

5 comments

  1. Thank you ever so for you blog post.Thanks Again. Really Great!!!

  2. Can anyone download the file “video_tank.mov” ? I can’t download it.

  3. what a rubbish is this…….
    where is its start………….

  4. hi, please try again. i just tried to download the file and it worked.

  5. Lathander /

    would you re-upload the file: tank_rig_start.rar.

    It seems as its not longer online.

Leave a Reply