No-Flip Knee Setup

A while ago I was creating a rig and used the method of no-flip knees that I previously posted. But when I had handed the rig off to the animators they found some errors with it. In certain extreme positions the poleVector would go crazy. I believe this was due to the aim constraint that I used. It would bug-out when it got to close to the target it was looking at. To fix it all you really had to do was reset the attributes, but I wanted to make something more stable. In the process of developing something different I came up with this technique. Not sure if others have used it, but I find it a lot more stable, easier to setup, and still maintain the benefits of the previous method that I used.

Start out with a simple leg joint chain. Upleg, Lowleg, foot, toe, toeEnd.

figure1

figure1

Now run an RPIK solver from the upLeg to the foot joint. Rename the ikHandle; leg_ikh. Now create a locator, snap it to the lowLeg joint and pull it out in front of the knee. Rename the locator, knee_PV. Create a poleVector constraint between the locator and the leg_ikh. This will allow the animator to control where the knee points by positioning the locator. Now if you grab the leg_ikh and try to position it above the knee_pv the knee will flip. You can fix this of course by moving the knee_pv out in front of the knee again. But this can get annoying fast. So next I’ll show how to create the “No Flip” part.

figure2

figure2

Now create a nurbsCircle. This will be the foot control, rename it foot_anim and position it at the base of the foot. Then parent the leg_ikh to the foot_anim. Now go to the side view and create a joint chain from the up leg to the foot. This is seperate from the leg hierarchy. I rename the two joints noflip_1_joint and noflip_2_joint. Create an RpIK solver from noflip_1 to noflip2. Its important to use the RP solver because we will be using a poleVector. It is posible to skip the poleVector step and in fact my first version of this method didn’t use the poleVector but as you will see soon it solves a different problem later. Rename the ikhandle noflip_ikh and parent the noflip_ikh to the foot_anim. Then parent the knee_pv to noflip_2_ikh. As you can see, if you move the foot_anim around, that the knee_pv stays in a predicable place in front of the knee and doesn’t flip if the foot_anim is placed higher then the hip. Select the foot_anim and change the rotation order to yzx. This will only work if your Local Rotation Axis is the same as mine. Which for the foot_anim is X-up toward positive Y, Z-forward toward positive Z, and Y- toward negative X.

Create a locator and place out to the side of the foot_joint pivot. I left it name locator1. Select Locator1, noflip_ikh, and create a poleVector constraint. Then parent the locator1 to the foot_anim. The rotation order change and the poleVector both help to make the system stable but also to isolate the rotations of the knee following the foot.

figure3

figure3

A problem that I didn’t originally intend to solve was when rotating individual axis of the foot. I want the knee to follow the ankle when rotating, in my case the X-axis only. I do not want the knee to be affected when rotating about the other axis. Using the IK solution with an RP solver, and with the aid of changing the rotation order to yzx. Rotating along X is the only thing that affects the knee.

Now we are basically done with the noFlip rig, but there is something else to consider with this system. Some animators like grabbing something and moving it (like the knee_pv) to position the knee. Other animators like to change a channelbox attribute. The later is easy to add, and it makes both types of animators happy.

Select the foot_anim and go to the channelbox and add attribute. First I add an Enum attribute called Knee_PV_Vis and change the strings to Off and On. Then I add another attr called Knee, with a default value of zero and thats it.

figure4

figure4

Open the connection editor load the foot_anim on the left and the knee_pv on the right. Connect the knee_pv_vis  to the knee_pv.visibility attribute. Now when you change the off/on attribute it cycles the visibility of the knee_pv. This is hide to the knee control for the animators that don’t want to use it.

Next create an empty group at the foot pivot. Then parent it to the noflip_2_joint, then parent the knee_pv to the group. I renamed the group knee_pv_rot_grp. Open the connection editor, load the foot_anim on the left and load the knee_pv_rot_grp on the right. connect the knee attr to the rotateX (for me its rotateX, see what yours is and connect that instead).

We should be done. The animator can chose which method of controlling the knee they like and the we have a predicable noFlip solution.

Here is the maya 2008 file (change the .doc to .ma): noflipknee_setup_IK

Addition:

So I’ve been setting up my Work In Progress, the Ninja Rig, and as I was trying to apply this No-Flip-Knee Setup when I encountered some sticky spots. If you aren’t working with the ideal leg model, like in the example, here is something to keep in mind. When setting up the no flip joints create them so the last joint is straight up and down to the foot or ankle joint. this could make the first joint not sit in the same position as the hip, but that’s ok. if it doesn’t lay perfectly straight with ankle you wont get individual axis rotation with the ankle.


10 Responses to “No-Flip Knee Setup”

  1. simpler and fewer steps than my setup, nice work. 😉

  2. File did’nt download. Could U please send it to my mail ID

  3. I see that its not working, I’ll get the file up soon.

    Ok its should be working now. Thanks for letting me know!

  4. This is the most awesome spine ever! I wish I could trade mine in for it ;P Thank you for sharing it! Btw, do you know how to set up an arm with ikfk switching that is stretchy. I’ve tried, but the arm goes wacky.

  5. Sorry! @_@ I just realized I left the comment on the wrong page.

  6. stupidVampire: the arm switching your talking about is something i know how to do, but i dont have a tutorial for it yet. In the mean time here is a link to a video that explains some of what you want. http://www.snolan.net/category/rigging/

  7. ha, that’s interesting. I just came up with this same solution a couple weeks ago and then today I found your post about it. This could’ve saved me some time when I was working it out.

  8. Thankyou very much Mat, it’s great of you to share these methods! 🙂 Just a question on the side, just wondering if you know when you’re gonna do the part 2 of the awsome spine? Cheers

  9. Thank you very much. This is really great.

  10. […] on a few methods online to understand how it was done and the most stable way to do it. “https://faithofthefallen.wordpress.com/no-flip-knee-setup/”. This website helped me to understand why the no flip knee was needed, and how to create an […]

Leave a reply to te Cancel reply