The following procedures describe how to set and retrieve data for multiple Effectors in an HIKEffectorSetState using a data set that contains a transform matrix to represent each Node’s translation, orientation and scaling values.
In a memory buffer aligned on 16 bytes, store the following items for each Effector:
// first Node's data block
// -- matrix data
{-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,
// -- constraint data
0.5f, 0.5f, 1.0f, 0.0f},
// second Node's data block
// -- matrix data
{-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,
// -- constraint data
0.5f, 0.5f, 1.0f, 0.0f},
},
// third Node's data block
...This data description must be an instance of the HIKEffectorDataDescriptionMatrix 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 myUsedEffectors[] = {HipsEffectorId,
LeftAnkleNodeId,
RightAnkleNodeId,
...
RightFootPinkyEffectorId,
HIKLastNode
};
HIKEffectorDataDescriptionMatrix myDesc = {0,
64,
sizeof(float)*20,
myUsedEffectors
};Call the HIKSetEffectorStateData() function to apply the translation, rotation, scaling and IK constraint values contained in your data set to your HIKCharacter.
HIKSetEffectorStateData(lEffectorState, &myDesc, (void *)goalBuffer[frameId]);
To retrieve Effector data from an HIKEffectorSetState State using transform matrices for the translation, quaternion rotation and scaling values of each Effector, you must follow a process similar to that described under Setting and Retrieving Effector Data Using Matrices above, except that: