Creating a Character Rig – Part 17: Non-uniform no flip IK leg stretch and automatic IK FK toggle

Creating a Character Rig – Part 17: Non-uniform no flip IK leg stretch and automatic IK FK toggle


In the previous movie, we created a snappable knee that allows us to plant it in a specific spot. In this movie, we’ll add non-uniform stretching to the no-flip leg and then start cleaning up the leg rig. Start by opening the file “17-0-Character_Rigging_part17_start.mb” or by using your own file from the previous lesson. By creating a snappable knee, we also inadvertently added the ability to scale each of the pole vector leg joints non-uniformly. Likewise, the FK joints also have the ability to scale non-uniformly as well. In order to guarantee parity, we should really add this ability to the no-flip leg. In the leftLeg_settings_CTRL, set the leg to IK, and the knee to “Auto” mode. Now, let’s add a new attribute to the leftFoot_CTRL called “autoKneeThighLength”. Set a minimum value of 0 and the default value of 1. Create a second attribute for the shin called “autoKneeShinLength” and give it the same min and default values. We’ll use these new attributes to manually adjust the length of the thigh and shin no-flip IK joints. Select the leftFoot_CTRL, and no-flip shin and foot IK joints. Open the Node Editor and show the connections. If we take a moment to look at the Node Editor, notice that our thigh’s length, determined by the “Translate X” value of the shin joint, is already calculated by this animation curve node. Remember that this represents the driven key scaling we created for the entire no-flip IK leg in part 14 of this series. Create a Multiply Divide node and rename it “leftThigh_noFlipScale_MULT”. To scale the thigh specifically, we just need to connect the “Auto Knee Thigh Length” attribute from the leftFoot_CTRL to the “Input 1X”. And the “Output ” of the driven key animation for the shin into the “Input 2X”. Then replace the no-flip shin’s incoming connection to its Translate X attribute, with the “Output X” of the Multiply Divide node. You can now extend the thigh using the attribute on the leftFoot_CTRL. We’ll hook up the shin length attribute the same way. Create another Multiply Divide node and rename it “leftShin_noFlipScale_MULT”. Connect both the “Auto Knee Shin Length” attribute from the leftFoot_CTRL and the “Output” of the driven key animation for the foot as inputs. Then replace the existing input to the no-flip foot’s “Translate X” attribute with the “Output X” of the Multiply Divide node. Now we can scale each part of the leg individually as well as a whole. We’re ready to consult our general rigging checklist. First, are our controls easy to use? The IK controls are pretty simple and straightforward, so let’s switch to FK mode. Our FK controls don’t appear because they’re assigned to a layer that’s currently hidden. This back-and-forth visibility toggling seems like it could potentially be annoying for the animator, doesn’t it? Why don’t we streamline this by having the FK controls appear automatically in FK mode, and the IK controls appear in IK mode? Start by adding some custom Boolean attributes to the leftLeg_settings_CTRL including “FK_visibility”, “IK_visibility”, and “knee_visibility”. Use the Connection Editor to connect these attributes to the “Visibility” attributes of the leftThigh_FK_CTRL, leftFoot_CTRL, and leftKnee_CTRL respectively. Now you can toggle the visibility of these controls with these attributes. Next, let’s tie the visibility of our controls to the blend mode we’re in. Open the Set Driven Key window and load the leftLeg_settings_CTRL as both the driver and driven. Set the “FK / IK Blend” attribute to 0 and the “FK Visibility” to “On”. Set a driven key between them. Now set the “FK / IK Blend” to 1 and turn off the “FK visibility”, then set another key. The FK joints automatically turn on and off when you switch from FK to IK mode. Repeat this for the IK controls. Now the controls’ visibility automatically turns on and off in their respective modes, but we can also override them via the visibility attributes. It’s important to note that this new functionality overlaps with that of the display layers. This could create some confusion for the animator. In order to eliminate the confusion, it’d be best to either remove the IK and FK leg layers, or hide these attributes, depending on your animator’s preference. For the sake of versatility, we’ll leave both avenues open. However, while turning the opposing controls’ visibility off when in IK or FK mode makes sense, what about when we’re between states? These states represent a blend between IK and FK, so really both controls should be visible at the same time. So set two driven keys for both sets of controls in their visible state when the blend attribute value is anywhere between 0.001 and 0.999. Now the appropriate leg controls appear in IK, FK, and blended states. We’ll set a driven key for the knee control exactly as we did for the IK and FK controls, but this time connecting the knee control’s visibility to the “Auto / Manual Knee Blend” attribute. The leftKnee_CTRL should disappear when in Auto mode. Finally, group the leftKnee_CTRL into a “leftKnee_GRP”. Now set a new driven key to connect the visibility of this group to the leftLeg_settings_CTRL’s “FK / IK Blend” attribute such that the control will never appear in FK mode. That’s quite a bit of cleanup so far, but we’ve only scratched the surface of our checklist. In the next movie, we’ll finish cleaning up our leg and integrate it into our entire rig.

13 Replies to “Creating a Character Rig – Part 17: Non-uniform no flip IK leg stretch and automatic IK FK toggle”

  1. Hi, my IK/FK_blend attribute on my leftLeg_settings won't go anywhere other than 0 and 1, so I am unable to set driven keys on the 0.001 and 0.999 as in your video. Do you have any idea where I might have gone wrong? I'm using Maya 2015. Thank you.

  2. What was the point in the re-keying of the fk/ik blend attribute to the visibility of the knee_CTRL? I believe it was already done via fk/ik blend -> knee visibility -> knee_CTRL, but I may be mistaken.

  3. +Dark Element It's so that you can see both controls when the blend is somewhere between 0 and 1 (i.e. transition state).

  4. For some reason my Auto / Manual Knee Blend is reversed so "0" is on and "1" is off, is there a quick way to swap this around? Thanks – Adam

  5. Curious: Why did you need to create the Boolean attribute for the Visibilities on the Settings control? Wouldn't it have been more straightforward if we just directly linked the FK / IK blend to the corresponding object's Visibilites instead?

    I'm guessing this is for the overriding purpose you mention in 6:52?

  6. When blending from 1 to 0 in the FK / IK Blend attribute in the Channel Box, the geometry of the leg twists a little bit from side to side on my version of the rig. Any tips on how to fix this?

  7. in maya 2016 i've done everything up to 3:02. when i then try to test the function in changing the value of the attribute – like it's shown in the video after connecting the nodes – nothing happens. what could be the reason for this?

  8. After doing this for the right leg, My rightFoot_result_JNT seems to not translate to scale the leg. When doing the snappable knee, the foot rotates up as well. Ive been going through my node editor trying to find the problem but I dont see it. Any ideas what it could be? My left foot works fine.

  9. hey, thanks a lot for those tutorials! is there n easy way to control if the legs are stretchy or not? my idea would be to duplicate the IK joint chains and make one of those non-stretchy, then blend between the two. but thats rather complicated. any ideas?

Leave a Reply

Your email address will not be published. Required fields are marked *