Maya – No Flip Knees with Local Global Switching

This method of creating no flip knees with local and global switch for the ankle is a compilation of ideas that were inspired by Aaron Holly.  Also there were some limitations I found with this way of creating No Flip knees, the animator no long had a control object to move that controls the knee rotations, also the animators want to have the control to rotate the knees with the rotation of the ankle or to turn that feature off. So I created this method as follows.

So I start off with a basic IK leg setup, I am not going to address IK/FK switching in this post, but it is easy to integrate into a switch system. basic setup As you can see from the picture that it has an IK chain running from the thigh to the ankle and the ik handle is parented to a control object. Very basic. So what we are going to do now is setup the pole vector constraint, this so the animators can have an iconic representation of the knee control. I created a NURBS cone and aligned it to the knee joint then selected the cone and shift-selected the ik_handle and click the poleVector constraint. So now the cone controls were the knee points. But if you move the foot control or the root control the knee control doesn’t move. And if you move the foot control up in Y it will flip when it passes the pelvis line. Flipping Knee We will now fix this problem.

Start by creating 4 locators I named them as follows: _l_knee01_pos , _l_knee01_aim , _l_knee01_up , _l_knee01_tgt . I use Aaron Holly’s naming scheme so it might look familiar. The _aim and the _up are parented to the _pos locator. Point and orient constrain the _tgt to the thigh joint. Then point-constrain the _pos locator to the foot control. Move the _up out a bit form the _aim locator on the X-axis. The _up locator will be used to define the up vector for the aim-constraint we will setup. Select the _tgt and shift-Select the _aim locator and go to the animation menu constrain->aim->[option box]. For the aim vector I used 1 for Y, so it would aim in the Y-direction. For up vector I used 1 for X, so that it would point toward the _up locator. For world up type I used Object Up and then in World Up Object I typed the name of my _up locator: _l_knee01_up. The orientation of the _aim locator should be relatively the same if some axis flipped try entering a -1 for the aim or up vector.

Once that is setup the _aim locator should always point to look at the _tgt locator constrained to the hip. This is exactly the behavior we want for the knee control. If you haven’t grouped the knee control to zero out the transformations do it now. If you don’t what I mean look here. Now all you have to do is parent the knee control group node to the _aim locator.

Now if you move the foot control up past the pelvis it doesn’t flip but rotates perfectly around. As you can see the knee control follows the movement of the foot control as well as the root control. NoFlip

Now on to the Local Global Switching. Sometimes animators want to be able to have the knee rotation follow the ankle rotation and sometimes they don’t want this behavior, so we are going to create a way to do both.

Right now if you select the foot control and rotate it the ankle moves independent of the knee. This is one of the behaviors we are after now we need the other. Create another locator and call it _c_bodyGlobal01_loc. You can move it off to the side just don’t rotate it. Right now it’s orientated to the world. Select the foot control and shift-select the _pos locator go to the constrain menu and click the parent option box. uncheck translate so it only adds a parent constraint for the rotation values. This will be our Local rotations inherited from the foot control. Now select the bodyGlobal locator and shift-select the _pos locator and do the same parent constraint. This is our Global rotations inherited from the bodyGlobal rotation.

So if you go into the hyperGraph and select the parent-Contraint node underneath the _pos locator, in the channel box you will see two weights. Set the first weight to 1 and the second to 0. Now if you rotate the foot control the knee rotates with the ankle. If you swap the weight values W0 = 0, W1 = 1, then you when you rotate the foot control the knee does not rotate with the ankle.

If your handy with MEL script you could easily make a GUI that will do this switching at the click of a button. You will notice that if you have it in Local mode, rotate the ankle, then switch to Global mode, the knee will pop back to its original position is this expected. To really fix it you will need to use MEL script. But basically what you do is before the local global switch unparent the knee control from the knee_control_group, do the local global switch, then parent back to the group.

That is basically it for the No Flip Knees with Local Global Switching. Please post any comments, questions, or corrections. There are probably mistakes, just let me know and I will fix them.

No Flip Knee File– Just change the extension to .ma


~ by animatix on February 13, 2008.

4 Responses to “Maya – No Flip Knees with Local Global Switching”

  1. I understood every single word of what you just wrote.

    Try to give me something that isn’t made for 6-year-olds who still wet the bed…

    Just kidding, obviously. You just blew my mind right now with the realization of how smart you are.

  2. really good tutorial : A+

  3. links to the first two images is broken 😦

  4. They are working for me. Is anyone else having trouble viewing the images?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: