It’s been a while! I’ve been very, very busy with school, but I haven’t been idle with rigging.
I finished a complete biped auto-rig for a video game project I’m helping out on. Here are its features:
- IK and FK arms and legs complete with Follow switching.
- Stretchy spline IK back with “advanced twisting” from the shoulders and hips
- Foot controls including a reverse ik foot, foot bank controls, toe roll, foot roll, and toe pivot.
- IK to FK blending using a simple Blend Color node
- Colored controls
- World Follow orient options for the head, neck, ik legs and arms, and fk shoulders
- IK clavicles
All this took a lot of trial and error, so here’s a little bit of documentation on what I learned. I do this for myself as much as I do it for you the reader, haha.
Let’s start with the arms. We have a three joint setup: ik, fk, and bind. The bind joints inherit the rotation attributes of their corresponding ik and fk joint. That is blended with a simple BlendColor node, a great trick shown by my rigging teacher Eric at SJSU. The ik arm is a rotate plane solver, and it is important to give a slight bend in the direction your arm should bend so that the trigonometry of the solver works correctly. Otherwise, Maya will just guess what angle it should bend at, which you obviously don’t want.
On the ik arm and fk shoulder controls we have a “Follow World” attribute that blends between 0 and 1. The hierarchy of follow controls like these works as follows:
So you have your control with its normal orient group above it. Group the control again to make your follow group. This gets orient constrained to multiple transform nodes, and simple attribute connection with one of them connected to a Reverse node will do the trick to switch between the two follow types.
Here is what the code for that might look like:
self.L_followSwitch = cmds.addAttr(self.myArm.getIKctrl(),at="float",ln="Follow_Clavicle",k=1,dv=0,min=0,max=1) self.L_followSwitchReverse = cmds.createNode("reverse",n="L_followSwitchArm#") cmds.connectAttr(self.myArm.getIKctrl() + ".Follow_Clavicle",self.L_followSwitchReverse + ".ix") cmds.connectAttr(self.L_followSwitchReverse + ".ox",self.myArm.getIKgrp() + "_parentConstraint1." + self.myBack.getGlobalCtrl() + "W0") cmds.connectAttr(self.myArm.getIKctrl() + ".Follow_Clavicle",self.myArm.getIKgrp() + "_parentConstraint1." + self.myArm.getIKclavicle() + "W1")
I also have an IK clavicle that drives the IK clavicle joint. The user has the option to make the ik arm control follow the clavicle, which essentially makes it work like an fk control. Someone might find that useful, who knows.
Obviously, making the controls all depends on you correctly aiming and xforming the orient node.
A few useful lines of code:
This orients the joint its children to “xzy” and sets their rotation axis orients to “zxy”. Clean joints are very important!
This is a fast way to null the joint orient values on an end joint.
I’ll have to continue this post another day because it’s getting late and I’ve been staring at screens all day. Gotta take care of my eyes!