Advanced IK Shoulder
This creates a shoulder that can be controlled from the wrist controller. The shoulder control will be keyable so that the level of control is up to the animator.
Open
Shoulder_rig.mb The file should look something like the image in figure 01.
Download these Mel scripts and place them in the "My Documents\maya\5.0\scripts" directory. These scripts will then be loaded when you start up maya and are necessary for these tutorials. If you have already done this in a different tutorial disregard these steps.
endName
jsChannelCtrl
jsConstObj
jsCreateCreature
jsDefineCreature
jsGetShape
jsListCreatures
jsMovIn
jsMovOut
jsOrientJoint
jsOrientJointUI
PickWalk
jsRenameWindow
jsRotateOrder
jsScaleJointsByCurve
jsUnlockTransforms
Duplicate the l_arm_up and remove the duplicated geometry under it. Parent the duplicate under torso_4. Rename the hierarchy, l_up_arm_IK, l_low_arm_ik, andl_wrist_ik.
This will be a controller ik skeleton to help make sure that the shoulder is driven properly from the wrist and elbow movement. It is important that these joints are not a child of the clavicle.
Its generally a good rule to parent your joints to the torso so that they translate and rotate as the character moves. Checking this occasionally on your own rigs is always a good idea.
Create a joint that goes from the l_shoulder joint to the l_low_arm_ik. This will be used to aim at the l_low_arm_ik.
Name the joints l_shoulder_aim and l_shoulder_aim_end.
Aim the joints so that z is up using the
jsOrientJointUI script.
Translate the shoulder_aim_end joint along its y-axis so that it is in about the same place as the l_up_arm. (figure 04)
Parent l_shoulder_aim under torso_4
Create an ikRPsolver from the l_up_arm to l_wrist and another from l_up_arm_ik to the l_wrist_ik.
Parent both of the ikHandles under the l_wristCtrl.
Create a poleVectorConstraint for both of these ik handles and use the l_elbowCtrl as the controller (select the elbow controller and then the ikHandle). The outliner should look something like figure 05.
Create a ikSCsolver from l_shoulder to l_up_arm.
Parent the ik under the l_shoulderCtrl.
Tip: To change the ik solver type go to the ik handle dialog box and switch the solver type from ikRPsolver, which is good for knees and elbows, to the simpler ikSCsolver.
Create a ikSCsolver from l_shoulder_aim to l_shoulder_aim_end. It may be easier to do this if l_shoulder is hidden. The shoulder aim should look like figure 08
Name the ik handle l_aim_ikHandle.
Parent the ik handle under torso_4. If you hid the l_shoulder you can unhide the shoulder now.
Create a locator. Name it l_auto and constrain it to l_low_arm_ik. (select the locator and then l_low_arm_ik constrain->point) It should move the locator right over the joint.
Create another locator and name it l_orig.
Move the locator to the same place as l_shoulder_aim_end.
Parent both locators under torso_4.
Select both locators and select l_aim_ikHandle and create a pointConstraint.
add an attribute to l_shoulderCtrl called "autoOrient"
make the min value 0 and the max value 10 and the default value should be .6
Open up the connection editor (windows->general editors->connection editor.) Connect the l_shoulderCtrl.autoOrient to the pointConstraint's l_autoW# attribute.
Open up the hypershade. Switch to the utility tab and create a reverse node. Open the hypergraph at the same time and select the l_shoulder. Hit the input output connections button and then middle mouse drag the reverse1 node down to the hypergraph.
Middle mouse drag the l_shoulderCtrl node over the reverse node. It will open up a menu and you want to select the input selection. This will open up the connection editor. Connect the l_shoulderCtrl.autoOrient to the inputX.
Connect the outputX to the pointConstraint's l_origW# attribute. Middle mouse drag the reverse1 node over the l_aim_ikHandle_pointConstraint1. Select other from the menu. The connection editor will open. Select the outputX on the left and the L_origW0 on the right.
Parent l_shoulderCtrl under l_shoulder_aim.
Unparent the ik handle under the l_shoulderCtrl. Freeze the transformation on the l_shoulderCtrl. Reparent the ik handle.
Now move the wrist controller and see how the shoulder follows the movement of the elbow. The amount the shoulder moves can now be animated with the autoOrient attribute on the l_shoulderCtrl.
Clean up the file. Create a new display layer. Name it untouchables and set it to reference. Go to edit->select all by type->ikHandles. Hide them and add them to the untouchables layer. Select the two locators, hide them and place them on the untouchables layer. Create a display layer and name it ikCtrls. Select l_shoulder_aim, l_shoulder_aim_end, l_up_arm_ik, l_low_arm_ik, l_wrist_ik and place it on ikCtrls. Make the layer a reference layer. Create another display layer and name it l_armCtrls. Select l_wristCtrl, l_elbowCtrl, l_shoulderCtrl and put them in l_armCtrls. Change the layer color. Lock the rotate, scale and visibility attributes for the l_elbowCtrl.