In the previous movie, we created three separate leg joint chains
and set up an IK/FK blending system to serve as a foundation.
In this movie, we’ll build on this by creating a high-level control for this blending system.
Open the file “11-0- Character_Rigging_part11_start.mb” .
or use your own file from the previous lesson
As we showed in the previous movie, you can already blend the result leg chain
between the IK and FK inputs by adjusting the “Blender” attribute at each joint.
However, that's not very convenient to have to change the value of every blend node
whenever we want to change modes
Just like the space switching on the head rig we covered in part 9 of this series,
we’d prefer to have a custom attribute to control this.
However, where would we put this attribute?
Unlike the hybrid solution we used for the head,
our IK and FK leg solutions will be almost entirely autonomous from each other.
We could put it on either an IK or FK leg control, but then if we toggled the visibility of that control,
it would make it hard to access that attribute.
Instead, we’re going to aggregate settings like this into a separate node
easily accessible by animators.
However, why should we settle for just that?
We should also create some representation of the settings in the workspace
for us to click on as well.
We'll start by creating the base of the switch with a NURBS circle.
We'll then use the EP curve tool in "Linear" mode to create a small cross inside the circle.
Finally, create one final line sticking out of the shape so it resembles a lever.
We've finished our basic switch shape,
but unfortunately it currently exists as a number of separate objects.
This is not good since we want just one object to contain our custom attribute.
To fix this, first freeze all the curves’ transformations.
Turn on Display > Shapes in the Outliner
and select the shape node for every curve except the NURBS circle.
Ctrl + select the NURBS circle and use the MEL command “parent –r –s”
to parent the shape nodes to the circle's transform node.
Now clicking any of the shapes selects the same object.
Rename this node “leftLeg_settings_CTRL” and then delete the leftover transform nodes.
Now use the transform tools to place it behind the foot like so.
Finally, parent constrain it to the leftFoot_result_JNT.
Now the control follows the result leg whenever it moves.
Let's group this settings control into a group named "settings_GRP",
since it will be joined by similar controls for the other leg and arms as well.
And then we'll put this group in its own layer named “settings_LYR” and set the color to purple.
Lock and Hide the new control's "Scale" attributes,
along with all the parent group's attributes.
Now we’re ready to create our custom attribute.
Let’s create a custom attribute on this node named “FK_IK_blend”.
We know from naming previous attributes that this will appear as "FK space IK".
However, we can use the Override Nice Name command
to have it appear in the Attribute Editor as "FK / IK Blend" instead.
Set "Minimum" to 0 and "Maximum" to 1.
The idea is that when the value is 0, the leg will be in full FK mode
and when the value is 1, the leg will be in full IK mode.
We leave the values in-between keyable,
in case an animator wants to blend between the two positions over time.
To set this up, we could use the Node Editor as we have before,
but it would be a lot faster and easier to use the Connection Editor instead.
In the Outliner's Display menu, turn off "DAG Objects Only"
Select the leftLeg_settings_CTRL node and load it into the left column,
then scroll down and Shift + select all the blend color nodes and load them into the right column.
In the left column, select the "FK / IK Blend" attribute.
Then in the right column, systematically click the “Blender” attribute
of each of the blend color nodes to connect them.
Now let’s give it a test run.
With the blend set to 0, try rotating the FK leg.
Notice that the result leg and geometry go with it.
Change the value to 1 and the result leg snaps back to the IK leg, still in its default state.
Any value in-between will get you a part-way state between the two.
Now return all the joints back to their 0 rotation values.
Excellent, now we have a blend that's actually easy to work with.
Re-enable "DAG Objects Only" and turn off "Shapes" in the Outliner to keep it clean.
In the next movie, we’ll create controls for our FK leg
including adding the ability to stretch the joints.