Rigging a Detailed Tank Track using C4D, XPresso, and Mograph
This tutorial will show the user how to rig a detailed tank track using Cinema 4d, XPresso, the Mograph module, and Roll-It -- a free plugin. The final result will be a tank track that animates automatically as you move and rotate it.
Final Effect Preview
Open the NAMETHISFILE.c4d file provided. It contains a track link already modeled.
Drop the Link into a Mograph Cloner object (Mograph menu>Cloner Object). Set the Count to 60, the Mode to Linear, and the Displacement to 24m on the Z axis.
Create a Bezier Spline object (Objects>Create Spline>Bezier), and draw out a spline similar to the one below. This spline was drawn from the side view (Press F3) and is roughly 600m long by 100m high. Be sure to click and drag when you create the new points to give smoother curves.
Insert a Spline Wrap object (Mograph>Spline Wrap), and group it with the Cloner object by selecting both objects in the objects manager and pressing alt+G.
Click on the Spilne Wrap object in the Object Manager. In the Attribute Manager, set the Banking to 270 degrees, the Mode to Keep Length, the Axis to Z+ and drag the spline from step 3 into the Spline box.
Depending on the total length of your spline, the links will either have a gap or an overlap (overlap is pictured in this image).
To remedy this, adjust the number of Count in the cloner object until you reach the closest fit without overlapping. From there, adjust the Z value to fine tune. In this case, the Count was reduced from 60 to 58, and the Z value was increased from 24 to 24.1. This closed the tiny gap that was left over
If all is well, your track should look something like this. Now on to the wheels and rigging.
Create a cylinder (Objects>Primitives>Cylinder).
Set the Orientation of the cylinder to X+, the Rotation segments to 50, and the Height to 20.
Move the cylinder into place and adjust the Radius setting so that it fits between your top and bottom tracks. In this example, the cylinder was reduced from 50m to 48m.
Right click the cylinder in the object manager and select Make Editable (alternatively, press C with the object selected). Then, select the Phong tag and set the Phong Angle in the Attribute Manager to 22 degrees
Go into Polygon mode and select the Knife tool (Structure>Knife). Set the Mode in the Attribute Manager to Loop, and make two cuts as shown below.
Use the Loop Selection tool (Selection>Loop Selection) and select the ring of polygons in between the two cuts.
Extrude the polygons selected (Structure>Extrude).
Go into Point mode, select the center point of the wheel, and move it back by 10m. Hold shift once it's moving to snap the movements to increments of 10.
Create a Tube (Objects>Primitive>Tube). In the Attribute Manager, Set the Inner Radius to 10m, the Outer Radius to 15m, and the Height to 5m.
With the Tube selected, use the Transfer tool (Functions>Transfer), and hover the cursor over the wheel. A line will appear between the Tube and the wheel. Click and the Tube will be transferred to the surface of the wheel.
Create a Cylinder. Set the Height to 8m, the Radius to 2m, and the Orientation to Z+. Name this Cylinder "Bolts".
Insert a Cloner Object (Mograph>Cloner) while holding alt, and the Cylinder will be placed under the Cloner in the Object Manager. Set the Mode to Radial, the Radius to 12m , and the Count to 6. Name this Cloner object "Bolts Cloner".
As with the previous step, select the Cloner object and use the Transfer tool (Fucntions>Transfer) to center the array on the wheel by clicking on it, the rotate the Cloner by 90 degrees so it will line up with the wheel.
Place the Tube under the "Wheel" object in the Object Manager. Then, select the Cloner for the Bolts and the Wheel object, and group them (Right click>Group or Alt+g). Name this group Wheel.1.
Use the copy paste function to copy the wheel out. Once you have four wheels, select them all and duplicate them. Move this new group behind them and offset it as shown below.
To build the gear, create a Cogwheel Spline (Objects>Spline Primitives>Cogwheel).
Scale the Cogwheel Spline to fit in the path you've created, then in the Attribute Manager, adjust the number of Teeth to fit your path. In this case, the magic number was 13. The Inner Radius in this image is 45.6, while the Outer Radius is 55.8.
Drop the spline into an Extrude Nurbs object (Objects>Nurbs>Extrude Nurbs) and set the Movement to 8m. Be sure to zero out the other Movement boxes. Position the gear to fit inside the stirrups.
Select the Wheels, the Gear, the Spline, and the group that contains the Splinewrap and Cloner and group them all together. A good name for this group would be "Track".
Select all 8 wheels. right click them, and add a Roll-It tag. Roll-It is a free plugin and can be downloaded from the link at the top of this post. We'll use Roll-It to automate the rolling of the wheels and gears, which will in turn deform the track.
Under the Roll-It tag, manually set the Radius to that of your wheel. In this case, the wheel was 96m in diameter, so the Radius is set to 48. The Calculate function should not be used as the tag is on a null object and will always result in a radius of 0
Add a Roll-It tag to the Cogwheel spline (not the Extrude Nurbs object). The Radius value for the gear is very tricky, and will be tweaked later on in the tutorial.
Right click on the Spline Wrap object and add an XPresso tag. XPresso is Cinema 4d's node based programming environment. It's proven to be a valuable time saver and today we'll build a very simple script.
Double click on the Xpresso tag and you'll be greeted with a grid. From the Object Manager, drag and drop the Spline Wrap object and the front-most wheel into the Xpresso window as seen below.
Right click on the small red box on the wheel (this is the output box for your wheel) and add a Rotation.P port (Coordinates>Rotation>Rotation.P). Now right click on the blue box (input) on the Spline Wrap, and add an Offset port. (Object Properties>Offset). The Offset value controls the position of the track in its journey around the spline.
Right Click anywhere in the XPresso grid and add a Math node (New Node>XPresso>Calculate>Math). Position it between the Wheel and the Spline Wrap node, and drag wires between the inputs/outputs as illustrated in the image. The output of the Wheel's rotation is "carried" over to the Math node, which will hand it off to the Spline Wrap.
The problem now is that the output of the Wheel's rotation doesn't translate directly to the Offset setting for the Spline Wrap. It has to be geared down, so to speak. Click on the Math node, and look over to the Attribute Window (below the Object Manager). Set the Function to Divide, and set the Input to 30. This is a number you will have to tweak, as it is affected by the length of the spline, the diameter of the wheels and so on.
The last step is to tweak the values of the Math Node to ensure that the track sticks to the ground and doesn't slide forward or backward when moving the parent object. The value of the Radius in the gear's Roll-It tag should also be tweaked to match up with the track. In this case, it was reduced from 55m to 51.5m to match the speed of the track.
All that is needed to animate the track and roll the wheels is to move the parent object (named Track in this tutorial) forward or back. This group can also be dropped into a larger parent object such as a tank and will animate automatically
An optional addition to the rig is to add a Morph Tag (Right click>Character Tags>Morph) to the Track Spline, and to set a Morph Target of the spline straightened out as shown below. This is achieved by simply moving one of the points on the spline upward. On larger vehicles such as tanks, the heavy metal tracks straighten out like this when the vehicle accelerates or suddenly hits the brakes. The Morph Target value can be keyframed to work this into your animations. This step is mostly unnecessary for smaller, rubber tracked vehicles such as robots.