EVEN MORE ON THE LEG IK
Now, let's go to the second attribute. The inherit swivel. This is actually just a fake. Whai I did was create a script controller that controls the FootControl's Z rotation based on the value of this slider. If the slider is at 1, the FootControl (and thus the whole foot) will rotate with the leg. If its value is 0, it won't rotate. It's really simple to set up, so let's start doing it.
Select the FootControl point object, and assing a script controller to its Y rotation track. The script controller window will appear. There will be a number on it. TAKE NOTE OF THAT NUMBER! You may insert a line or two before it. Then, enter the following script...
First, select the two IK chains in the foot, and turn off the Use swivel angle at the IK solver properties rollout (motion panel). We don't need swivel angles for these solvers. Now, select the ControlFoot object, and add the following custom attributes to it...
dependsOn $A_FootControlRT.swivel_angle $A_FootControlRT.inherit_swivel
-degtorad($A_FootControlRT.swivel_angle * $A_FootControlRT.inherit_swivel)-1.57074
Notice that the actual names of the nodes involved don't match mines. Remember I add a LT or RT suffix to each node depending on what part of the character it is (RT= right, LT=left), and that I add a prefix depending on the character so that I won't have duplicate names when merging characters together (A_ = Astro). Just adjust the names as needed, but these MUST match the ones of your objects, or you'll get undefined errors when evaluating the script. Substitute the number I've got at the end of the script (-1.57074) with the one the script controller window gave you when it opened (it can be a positive or negative number). Press evaluate. If you don't get any errors, adjust the swivel angle. You'll notice that the knee rotates, but the foot doesn't. This is because there seems to be an issue with script controllers referrencing attributes located in the same object they're in. To have the controller update itself, move the slderbar a bit. You'll see the foot react. If it rotates in the opposite direction, erase the minus sign before the degtorad expression in the script. Close the window. Now, convert this script controller into a list controller (the scrip controller will be inside of it), assign a bezier floar controller to the available track and set it as active.
There is another node that needs to react to the inherit swivel, adn it's the Rotator_foot object. Now, this one is a little bit tricky, because it's not aligned to the leg. However this doesn't mean it won't work. Here's how it's done.
Select the rotation track on this object (I used a local euler controller). Convert it onto a list controller. Assign another euler controller at the avalialble track. Name this controller something like EulerXYZ_auto. Now, assign script controllers to both the X and Y tracks. Enter the exact same script you have above to these controllers. The difference will be that you won't need to add or substract a number from the expression, since the controller gave you a value of 0 when it was assigned. The only difference between both tracks is that you should enter a number at the end of the expression for the X track. This is the script I have:
dependsOn $A_FootControlRT.swivel_angle $A_FootControlRT.inherit_swivel
degtorad($A_FootControlRT.swivel_angle * $A_FootControlRT.inherit_swivel)/1.7
So, how did I get that 1.7? By eyeballing. What does it do? It compensates for the misaalignement between the leg's oriantation and the foot's. If you don't add that number, you'll see the Rotator over-rotate in response to the swivel angle. This division compensates and makes the Rotator rotate properly. By the way, for some strange reason, this object won't react interactively. Just scrub the time slider to force an update.
There you are. You've got everything all wired up now. We need still to add some more controls so that our foot behaves solidly as one single unit, so let's take that last stretch.
Select the LocalRotation node, and assign an expression controller to its X rotation track. Take note of the number that appears at the expression window. Create a scalar variable, and assign it to the Rotator_foot's X rotation track. In the expression window, enter the variable's name and add or subbstract the number the expression gave you from it. Close the window. Turn this expression controller into a list controller, assign a bezier controller to the available track, and set it as active.
So, we're done. Your foot (and at this point, the whole puppet) must be ready and steady. I always try my rigs by doing a small short animation where the rig is really stressed. If your rig breaks, you need to work on it. If it does the job, you're ready to go into production. But before you jump into doing Toy Story 3, let's do the last touch ups to the rig.
ANIMATABLE PIVOT POINTS
What we'll do is add some link constraints to the puppet, so we can controll it much better. I'm not even going to explain the procedure, but here's what I did and why.
So, what is this all about? Obviously, you'll want to keep the hands and feet independent from the body when animating, so why link them to it? First, it allows me to place my character with more ease. When you merge a character onto a new scene, most of the time you'll need to move him. This way, I just move the COM, and the hands and feet go with it. When I start animating, I just add another object as a new target (most of the times I add the floor), and animate. Also, it works when the character needs to fly. By having the hands and legs linked to the COM, I can concentrate of the flying without worrying of having nodes stay behind. And the third advantage is that if my character needs to yield, say, a daito (a sword you hold with both hands), I can link both hands to it and animate the sword, instead of linking the sword to one hand, animating the hand, and having to match the other hand to the sword (this also applies to carrying a box).
And what about the COM? Well, by linking it to two different objects (the two Points we added) at different times, you can have an animatable pivot point. What if you want the character to do a backflip, land on one finger, and rotate several times on it while twisiting a-la break dance? Easy. When you're done with the backflip, just place the pivot at the point of his finger as he lands, link the COM to it, and animate the pivot rotating. The whole character will rotate at that point (I also use the ground as a target for the constraint when I need no extra pivot). I don't add the pivots and the pivot constraint until my character is already on stage, so you might want to skip that on your character files, and leave it for the scene files.
I hope you enjoyed creating this rig. As you can see, character rigging is an art onto itself, and I must say I enjoy rigging characters as much as I enjoy animating them. I've uploaded my rig file, so you can take a look at it, disect it, modify it, etc. I hope this was of any help, and that you'll be able to rig anything else you come up with. Have fun, and let me know how you liked this. Luck!!
DOWNLOAD THIS TUTORIAL'S RIG