Tuesday, 8 November 2011

IK/FK Switch and Constraining

First of all, I am going to talk through the setting up of the IK and FK switches; this was a fairly easy thing to set up in both arms.  In the last post, you may have noticed, in the screenshots, these NURBS circles that were located at the shoulders and elbows; in addition to the wrist curve which I did mention in the last post.  These were going to serve as my FK controls and I needed to set up a system 
I started with the left arm by creating an attribute in the wrist control which was called IKFK Blend.  This was going to drive the Visibility of the shoulder and elbow curves (but not the wrist curve, as this needs to stay visible at all times, to control the orientation of the wrist and switch between IK and FK).  I keyframe the IKFK blend at 1 and the IK Blend in the IK Handle at 1.  I keyframed the shoulder and elbow curves visibility as off.
Next, I set the IKFKBlend to 10, and then I keyframed the shoulder and elbow curve visibility as on; and I keyfraned the IK Blend in the IK Handle as 0, meaning that it no longer influence the arm, when the IKFKBlend attribute was set to 10.  The IK arm control and Pole vector control were keyframed as well, so that it was invisible when IKFKBlend was set to 10 but visible when set to 1.  I repeated this whole task on the right arm.
 Next, I needed to constrain the shoulder and elbow curves to their respective joints.  I did this by applying both a Point and Orient constraint between these curves and joints.  I also parented the elbow curve to the shoulder curve with a simple shift select and press of the 'P' button.

Next, I needed to Constrain the wrist curve to the elbow curve.  However, I could not do this the conventional way as the wrist was already parented to the IK Handle control and this would mess up the hierarchy.

I resolved this by creating a group for the wrist curve only.  As the wrist curve itself was parented to the IK handle curve, I parented the group, to the elbow curve.  Now, when I rotated the elbow, or indeed the shoulder, the wrist would follow because the wrist itself was still constrained to the IK arm control but the node that I had put the wrist into would be parented to the elbow.  This is a neat trick that I will keep hold of for whenever I am at risk of disrupting any constraint or group hierarchy.

Now, here is a video to remind you of what the character rig is capable of doing so far.
video

No comments:

Post a Comment