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

Tank rig tutorial

As we did with the wheel’s control object, we need to link the control objects to their respective objects’ parent.

In the track view copy-instance the transform controllers for each object and its control object, you can do it easier in the mini curve editor.

Now we can get the projectedPlane where it was before, select it, align it to the Control_Main (position and orientation) and activate its Conform Binding Modifier.

CANNON TARGETING SYSTEM

The cannon base will have a look_at constraint, also the turret but only over its z-axis. For both objects we need to create a point helper that finally contains the look_at controller, the objects will inherit their rotation.

Create two points helper, name them Helper_LookAt_Turret and Helper_LookAt_Cannon. Select the Helper_lookAt_Turret and align it to the turret, link it to the Turret’s Parent (the frame) and assign it a lookAt constraint with the Control_Target object as target. Then select the Helper_lookAt_Cannon, align it to the cannon_base, link it to the cannon_base parent (the Turret) and assign it a lookAt constraint with the Control_target object as target.

You may like to do not have the lookAt viewline disturbing in the viewport, so you can hide it in the motion panel, setting zero the “viewline length” value in the look_at constraint rollout.

There are some methods to get the rotation of an object that has a lookAt constraint, like using wiring with an ExposeTM Helper, which exposes an object’s transform values, even if it has any constraint assigned. But, I prefer to use script controllers, because i don’t need to create any extra object to make it work.

Select the Turret, in the motion panel -> Assign Controller rollout, select the Rotation: XYZ Euler Controller and assign a Rotation List controller to it. As mentioned before, this controller will enable us to have two controller layers, the first with the script controller and the other one to make manual adjustments.

In the Available controller assign an Euler XYZ Controller, go back to the first Euler XYZ, in the Z Rotation controller assign a script controller.

In the expression, first we need to find the local rotation values of the helper, that’s because the controllers need values in local mode (local values in max are respect to the parents). we can do that using the transform values of this helper and its parent.

The way that a 3d software inherits the transform values from an object to its children is to multiply the parent’s transform matrix by it’s children local transform matrix. having in mind this, we may find the child’s local TM by doing the inverse process. In math the inverse process of multiply two matrices isn’t divide them, it’s a special process called “Inverse”, max has a maxScript function for this.

so, the expression goes as follows: helper’s transform * inverse parent’s transform

From this resulting transform we need to extract the rotation value: (helper’s transform * inverse parent’s transform).rotation

Then we need to convert this rotation from Quaternion values to Euler angles values in order to be able to get its Z rotation value. To don’t make the code line too long, i assign this rotation to a variable and continue in the next line.

So, it goes as follows:

rot=(helper’s transform * inverse parent’s transform).rotation
(rot as eulerangles).z

For the helper we’re gonna create a variable called helper_lookAt assign the Helper_lookAt_Turret as node. we can get the parent node as an object’s property. The expression finally goes as below.

rot=(helper_lookAt.transform * inverse helper_lookAt.parent.transform).rotation
degtorad (rot as eulerangles).z

degtorad is a need because the controller handles rotation values in radians.

The Cannon_base will need all the rotation values from its helper_lookAt. we cannot assign the lookAt constraint directly to the cannon, because we wont be able to make manual adjustment to it. We could assign an extra Euler XYZ controller in the rotation list for manual adjustments, but it will have unexpected behaviors when we rotate it (this problem happens in rotation controllers only, in position controllers it doesn’t happen, and in the turret case, it doesn’t happen either because we’re using only one axis there).

But there’s a way to make it posible, we’re gonna link the cannon to the helper. Select the cannon_base and the Control_cannon_base objects and link them to the Helper_lookAt_cannon, then select the cannon_base, align it to the Helper_lookAt_cannon (orientation), now it has a wrong orientation, so rotate it 90 degrees over its local y-axis.

Doing this the cannon will inherit the helper’s orientation, and also we’ll be able to make manual adjustments.

You can move the Control_Target to check this out!.

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