Wiring a Custom Attribute
 
 
 

In this lesson, you will create custom attributes to control the foot. A custom attribute is a parameter you create yourself.

The parameter doesn't control anything until you connect it to another parameter in the scene. You will use parameter wiring to connect the custom attributes to the rotation of the foot's IK chains.

Prepare the scene:

  1. Continue from the previous lesson, or open the file tut_introrig_controls.max.

  2. If you are continuing from the previous lesson, go to frame 0.

Create custom attributes:

  1. Select CtrlFoot.
  2. Choose Animation menu > Parameter Editor.

    The Parameter Editor dialog appears.

  3. On the dialog's Attribute rollout, enter Roll as the Name parameter.
  4. Expand the Float UI Options rollout, and enter a range from 0 to 60.
  5. In the Attribute rollout, click Add.
  6. Close the Parameter Editor dialog.

Determine the rotation axis to be wired:

You want the new Roll parameter to rotate the IK chain at the ball of the foot so the character's heel will rise. In order to do this, you must find out which of the IK chain's axes of rotation should be affected by the parameter.

  1. Select IKBall.
  2. On the main Toolbar, turn on Select and Rotate.
  3. Change the reference coordinate system to Local.
  4. Rotate IKBall so the heel rises, and note which axis is affected by the rotation.

    You can easily see which axis is affected by watching the display of numbers above the rotation gizmo. The X axis value changes as you rotate IKBall.

  5. Undo any rotation you have done on IKBall before continuing.

Wire the custom attribute to the IK chain's rotation:

Now you are ready to wire the Roll parameter to IKBall's X rotation.

When you wire parameters, the wiring is limited to the time segment that was active when the wiring was set. You can change this setting in Track View later on, but it is much easier to set the maximum time segment you think you might need before wiring. In this case, you will change the active time segment to 1000 frames.

  1. Click Time Configuration, and change the Length parameter to 1000.

    Now you will create custom attributes on CtrlFoot, the control object for the foot. This will allow you to roll the foot by changing parameters on the Modify panel when CtrlFoot is selected. The custom attribute will be called Roll, and will range from 0 to 60 degrees.

  2. Select CtrlFoot.
  3. Choose Animation Menu > Wire Parameters > Wire Parameters.

    A pop-up menu appears, giving you a choice of all parameter paths that are available for wiring. In this case, there are only two, Transform and Object.

  4. On the pop-up menu, choose Object (Rectangle) > Custom Attributes > Roll.

    A dotted line appears, extending from CtrlFoot's pivot point to the cursor. The dotted line indicates that you should choose an object and parameter path for the second object in the wiring pair.

  5. Click IKBall.
  6. On the pop-up menu, choose Transform > IK Goal > Rotation > X Rotation.

    The Parameter Wiring dialog appears.

    This dialog shows you the parameters that will be connected, and the direction in which the control will occur. In this case, you want the Roll parameter to affect the IK chain's X Rotation parameter.

  7. In the center of the Parameter Wiring dialog, turn on the arrow that points to the right.

    This will cause Roll to control the X Rotation parameter.

  8. Click Connect.

    The parameters are now wired together. Leave the Parameter Wiring dialog open as you test the wiring.

Test the wiring:

  1. Move the Parameter Wiring dialog so you can clearly see the character's foot.
  2. On the Modify panel, increase the Roll parameter.

    The foot spins wildly.

    What is actually happening is a result of how 3ds Max handles rotations internally. You're probably familiar with degrees as a measurement of rotation. Ninety degrees is a quarter turn or rotation, 180 is half, and 360 is a full turn. However, many 3D applications use a different unit of measure called radians to measure rotations. Radians are based on the value of pi (approximately 3.1416).

    With radians, 2 times pi is a full 360-degree spin. That is, 6.28 radians equals 360 degrees. Conversely, one radian is equal to about 57 degrees.

    3ds Max comes with a built-in function, degtorad, that you can use to convert the Roll parameter to radians before passing it on to IKBall's X rotation.

  3. In the Parameter Wiring dialog, replace the expression Roll in the lower right entry area with degtorad(Roll).

    This tells the wiring to use this expression for IKBall's X rotation.

  4. In the Parameter Wiring dialog, click Update.
  5. On the Modify panel, increase the Roll parameter.

    The heel comes up as you increase the Roll parameter, and stops rising when Roll reaches its maximum value of 60.

  6. Save the scene as my_introrig_toewiring.max.

    You can find a version of this scene in the file tut_introrig_toewiring.max.

Set up toe rotation:

You can use CtrlFoot to move or rotate the entire foot. However, if you tip CtrlFoot forward, it rotates from the center of the control shape. You can make it rotate from the toe tip by aligning its pivot point with IKToe.

  1. Select CtrlFoot.
  2. On the Hierarchy panel, turn on Affect Pivot Only.
  3. Use Align to align its pivot point with the pivot point of IKToe. On the Align dialog, choose Pivot Point for both the Current Object and Target Object, and choose the X, Y and Z axes.
  4. Turn off Affect Pivot Only.

    Now, when you rotate CtrlFoot, it rotates from the tip of the toe.

    If you rotate CtrlFoot to test the setup, be sure to undo any rotation before continuing.

Wire the knee's swivel angle:

Now you will create and wire another custom attribute, this one for the knee's swivel angle.

  1. Select CtrlFoot.
  2. Choose Animation menu > Parameter Editor.
  3. Enter KneeSwivel for the name, and enter a range of –90 to 90. Click Add to create the custom attribute, and close the Add Parameter dialog.

    This adds a KneeSwivel parameter to CtrlFoot.

  4. Right-click CtrlFoot and choose Wire Parameters from the quad menu.
    TipYou can access parameter wiring from the quad menu, or by choosing Animation menu > Wire Parameters > Wire Parameters.
  5. On the pop-up menu, choose Object (Rectangle) > Custom Attributes > KneeSwivel.
  6. Click IKAnkle, and choose Transform > Swivel Angle from the pop-up menu.
  7. On the Parameter Wiring dialog, enter degtorad(KneeSwivel) in the lower right entry area.
  8. Turn on the right arrow, then click Connect.

Test the knee swivel:

The easiest way to see the KneeSwivel parameter in action is to look at the character with a bent knee. You can see this by going to frame 10, where the character is animated to bend its knee.

  1. Go to frame 10.
  2. On the Modify panel, change the KneeSwivel parameter.

    The knee swivels without affecting the foot.

Save the file:

  1. Reset Roll and KneeSwivel to 0.0.
  2. Save the scene as my_introrig_wired.max.

    You can find a version of this scene in the file tut_introrig_wired.max.

Next

Using List Controllers