If you do not need HumanIK to control certain joints in your character’s skeleton, you can increase the performance of the inverse kinematics solver by not solving new positions for those joints.
For example, if you write a controller using HumanIK that swivels your character’s hips and upper body to aim a weapon at the player, you can skip IK solving for your character’s legs and feet.
There are two possible methods of identifying to the inverse kinematics solver which body parts you want to solve, detailed below
Before you can use the inverse kinematics solver, either directly or indirectly through the retargeting solver, you must specify in your HIKEffectorSetState the solving steps that the IK solver should carry out. To specify the solving steps, you call the HIKSetIKSolvingStep() function, and provide any one or more of the elements listed in the HIKSolvingStep enumeration.
In the examples given under Inverse Kinematics Solving and Retargeting Solving, the HIKSetIKSolvingStep() function is called with the value HIKSolvingStepAll, which activates all solving steps. However, in your call to the HIKSetIKSolvingStep() function, you can instead specify only a subset of the solving steps available in the HIKSolvingStep enumeration, which configures the inverse kinematics solver to perform only the corresponding calculations.
For example, the following call configures the inverse kinematics solver to solve all body parts above the hips, omitting the hips, legs, feet, roll extraction, floor contact, and Squash ’n’ Stretch.
HIKSetIKSolvingStep (MyEffectorState, HIKSolvingStepBodyPull | HIKSolvingStepLeftShoulder | HIKSolvingStepRightShoulder | HIKSolvingStepLeftArm | HIKSolvingStepRightArm | HIKSolvingStepLeftHand | HIKSolvingStepRightHand | HIKSolvingStepHead | HIKSolvingStepSpine);
See also Inverse Kinematics Solving, and Retargeting Solving.
The HumanIK inverse kinematics solver is broken down into multiple smaller functions, each of which is responsible for controlling a limited set of the character’s joints, or performing a specific subset of the calculations involved in the overall IK process. When you invoke the inverse kinematics solver by calling the HIKSolveForEffectorSet function, the following specific functions are called in order:
As an alternative to calling the HIKSolveForEffectorSet() function, you can call these individual functions separately. This approach is intended primarily as a way to take advantage of the secondary processing units in cases where the full IK solver cannot be invoked due to memory restrictions. However, it can also serve as an alternative way to limit solving to specific body parts, subject to the following restrictions:
The inverse kinematics solver performs the HIKSolvingStepBodyPull step at the beginning of the solving process. This step affects all joints in the skeleton. After the solver satisfies the Pull settings for all Effectors to the best of its ability, it moves on to the other active solving steps in an effort to satisfy the position, rotation, Reach Translation and Reach Rotation requirements of the Effector that applies to each joint covered in those active solving steps.
Therefore, omitting a joint chain from consideration by the inverse kinematics solver using either of the methods above does not necessarily mean that that joint chain will remain exactly the same as it was in the original FK animation. Instead, it indicates that you are abdicating control over the final states of those joints, placing them entirely at the mercy of the Pull values assigned to the other joints in the skeleton. For example, the Pull value of a character’s hand may drag the character’s hips, legs and feet into another location, even when solving is not performed explicitly for the legs and feet.
If you want to control the final position calculated for a joint, whether to pin it to the original FK animation or to pin it to a specific position in your scene, you should enable IK solving for that joint, and set its Reach, Pull and Resist values appropriately such that it will be placed at the translation and rotation you intend. See also the detailed descriptions of Reach, Pull and Resist under Overview.