As introduced under Overview, HIKEffectorSetStates store the inverse kinematics goal points for each Node in a character’s skeleton, along with a set of parameters controlling how strongly the Effector pulls on its corresponding Node, and how strongly it pulls on the other joints in the character’s skeleton. The inverse kinematics solver balances the positions, rotations and parameters of all Effectors to construct a new HIKCharacterState containing the final pose for the character.
Any time you call the inverse kinematics solver, you first need to set up an HIKEffectorSetState with the target points for your character’s Nodes, and appropriate values for each Effector’s Reach, Pull and Resist constraints. See Inverse Kinematics Solving.
When using only the HumanIK retargeting solver, it is typically not necessary to set up your Effectors with translation, rotation and scale values or with constraint values, as this is done internally by the retargeting solver.
As introduced under Setting and Retrieving Data in HIKCharacterStates, HumanIK works internally in a normalized space: each HIKCharacterState stores rotation and scaling values for each Node without any offsets contained for that Node in the character’s default T-stance. Similarly, the IK goal points contained in HIKEffectorSetStates are in the same normalized space. When you provide an HIKEffectorSetState to the inverse kinematics solver in order to generate a new pose for a character, the solver expects the rotation and scaling values saved in the HIKEffectorSetState to already be in normalized space. Similarly, when you read rotation and scaling values from an Effector in an HIKEffectorSetState, the values returned will be in normalized space.
For Effectors whose corresponding Nodes have no rotation or scaling offsets in the character’s default T-stance, this normalized space is the same as global space. For these Effectors, you can set the rotation value for the Effector to the desired orientation of your character’s limb in global space. However, for Effectors whose corresponding Nodes do have rotation or scaling offsets in the character’s default T-stance, setting and retrieving rotation and scaling values for your Effectors in global space will not take into account the offsets in the character’s T-stance, which will likely result in unexpected rotation goals.
If you want to provide rotation and scaling values for your Effectors exclusively in global space instead of in the normalized space used internally within HumanIK, you can use the functions identified by the term CharacterSpace. For example, HIKGetCharacterSpaceEffectorStatefv(). When you set a rotation or scaling value for an Effector using one of these functions, the offsets contained in the character’s default T-stance for the corresponding Node are removed before storing the new values in the HIKEffectorSetState. Similarly, when you retrieve rotation and scaling values from an HIKEffectorSetState using one of these functions, the offsets contained in the default T-stance are re-applied before returning the values to you.
You can use these CharacterSpace functions for all Effectors, regardless of whether or not the T-stance contains rotation or scaling offsets for the corresponding Nodes. However, you may be able to increase performance by using these CharacterSpace functions only for Effectors whose corresponding Nodes contain offsets in the t-stance, as this will perform the conversion between normalized space and global space only when necessary.
An alternative way to provide normalized rotation and scaling offsets for the Effectors in an HIKEffectorSetState is to first set the translation, orientation and scaling of each Effector to match a pose contained in an HIKCharacterState—typically, the current pose of your character derived from your game engine. You then offset the translations, orientations and scaling of the Effectors as required in order for the character to reach a particular prop or turn its limbs as required, and re-apply those new values to the HIKEffectorSetState. Offsetting your Effectors from the data contained in an HIKCharacterState ensures that you will already be working in normalized space when you apply the offsets to the individual Effectors.