The following procedures describe how to set and retrieve data for multiple Nodes in an HIKCharacterState using a data set that contains a single transform matrix to represent each Node’s translation, orientation and scaling values.
To set your Node state from a data set containing matrices, follow the steps outlined below.
In a memory buffer aligned on 16 bytes, store a matrix for each Node in your HIKCharacterState that follows the format introduced under Transform Matrices. This matrix is the only information required for each Node; therefore, each matrix typically represents a data block on its own.
The offset of each matrix within the data set must be aligned on 16 bytes.
// first Node
{-45.95f, 87.81f, -205.81f, 0.0f,
-0.54f, 0.0f, -0.05f, 0.83f,
0.16f, 0.16f, 0.16f, 1.0f,
-36.91f, 85.10f, -203.83f, 0.0f},
// second Node
{-36.91f, 85.10f, -203.83f, 0.0f,
-0.39f, 0.57f, -0.40f, 0.58f,
0.16f, 0.16f, 0.16f, 1.0f
-37.17f, 47.86f, -218.01f, 0.0f},
// third Node
...This data description must be an instance of the HIKDataDescriptionMatrix structure. You must specify the following items for your data description:
This array may also include the special value HIKNotUsed, which instructs HumanIK to skip the corresponding data block.
int myUsedNodes[] = {HipsNodeId,
LeftHipNodeId,
RightHipNodeId,
...
RightFootPinkyDNodeId,
HIKLastNode
};
HIKDataDescriptionMatrix myDescription = {HIKGlobalSpace,
0,
sizeof(float)*16,
myUsedNodes
};Call the HIKSetCharacterStateTransform() function to apply the transform matrices contained in your data set to your HIKCharacter.
HIKSetCharacterStateTransform(lCharacter, lCharacterState, &myDescription, (void *)gSrcAnimTQS[frameId]);
To retrieve Node data from an HIKCharacterState using transform matrices for the translation, quaternion rotation and scaling values of each Node, you must follow a process similar to that described under Setting and Retrieving Node Data Using Matrices above, except that: