Setting up foot and hand contact requires configuration of both the HIKPropertySetState and the HIKEffectorSetState that you provide to the HumanIK solver, as detailed in the following sections.
Foot and hand contact are enabled and configured in the HIKPropertySetState that you provide to the HumanIK solver.
To enable foot contact, set the mode of the HIKFootFloorContactId property to HIKModeOn.
To enable hand contact, set the mode of the HIKHandFloorContactId property to HIKModeOn.
HIKSetPropertyMode(MyPropertyState, HIKFootFloorContactId, 1); HIKSetPropertyMode(MyPropertyState, HIKHandFloorContactId, 1);
The most important configuration option for the floor contact engine is the contact type used to model your character’s feet and hands. For details on these contact types, see Contact Types.
To set the contact type for your character’s feet, set the value of the HIKFootContactTypeId property to one of the following values.
To set the contact type for your character’s hands, set the value of the HIKHandContactTypeId property to one of the following values.
HIKSetPropertyValue(MyPropertyState, HIKFootContactTypeId, 3.0f); HIKSetPropertyValue(MyPropertyState, HIKHandContactTypeId, 1.0f);
Depending on the contact type you choose, you must also configure a set of auxiliary properties that determine the placement of the markers defining your character’s feet and hands. Although HumanIK provides a set of default values for these properties, it is recommended that you set values more appropriate to the size and shape of your model. For details on which auxiliary properties you need to set for your chosen contact type, see the description of the different contact types under Contact Types.
For example, when configuring your character’s feet to use the Normal contact type, you must set the following properties:
HIKSetPropertyValue(MyPropertyState, HIKFootBottomToAnkleId, 12.0f); HIKSetPropertyValue(MyPropertyState, HIKFootBackToAnkleId, 3.0f); HIKSetPropertyValue(MyPropertyState, HIKFootMiddleToAnkleId, 11.7f); HIKSetPropertyValue(MyPropertyState, HIKFootFrontToMiddleId, 6.9f); HIKSetPropertyValue(MyPropertyState, HIKFootInToAnkleId, 3.4f); HIKSetPropertyValue(MyPropertyState, HIKFootOutToAnkleId, 5.1f);
If you are using the HumanIK retargeting solver, you need to set up for your target character all of the foot/hand dimensions that are used to place the foot/hand markers in your target character’s contact type. For your source character, you must set up only the HIKFootBottomToAnkleId property; the other foot/hand dimension properties listed above are not read from the source character.
The HIKPropertySetState you use for your character offers several other optional properties that you can configure to control the behavior of the foot and hand contact engine. For details on these properties, see Foot and Hand Contact Properties.
Once you have enabled and configured your character’s foot and hand contact, you can also enable and configure floor contact for your character’s toes and fingers in the HIKPropertySetState that you provide to the HumanIK solver.
Toe and finger contact is typically used only for characters with individually articulated toes or fingers that are controlled by HumanIK, and typically in conjunction with the Normal foot or hand contact type.
To enable toe contact, set the mode of the HIKFootFingerContactId property to HIKModeOn.
To enable finger contact, set the mode of the HIKHandFingerContactId property to HIKModeOn.
HIKSetPropertyMode(MyPropertyState, HIKFootFingerContactId, 1); HIKSetPropertyMode(MyPropertyState, HIKHandFingerContactId, 1);
The HIKPropertySetState you use for your character offers several other optional properties that you can configure to control the behavior of the foot and hand contact engine. For details on these properties, see Foot and Hand Contact Properties.
Once you have defined the way your character’s feet and hands respond to contact with the floor or another oriented plane, you must define the actual position and orientation of the plane that HumanIK should consider for each foot and each hand. Plane locations for each foot and hand are stored and maintained separately in the HIKEffectorSetState you provide to the HumanIK solver.
To set the oriented plane for the floor contact engine, call the HIKSetEffectorFloorStatefv() function for each limb. This function requires the following arguments:
HIKSetEffectorFloorStatefv(MyEffectorState, HIKLeftFootFloor, matrix); HIKSetEffectorFloorStatefv(MyEffectorState, HIKRightFootFloor, matrix);
As an alternative, you can also use the HIKSetEffectorFloorStateTQfv() function, which accepts two four-element arrays of floating-point numbers containing the translation and rotation of any point on the oriented plane.
const float transform[] = {35.1f,0.9f,276.7f,1.0f};
const float rotation[] = {0.4f,0.0f,1.3f,1.0f};
HIKSetEffectorFloorStateTQfv(MyEffectorState, HIKLeftFootFloor, transform, rotation);
HIKSetEffectorFloorStateTQfv(MyEffectorState, HIKRightFootFloor, transform, rotation);The final step in setting up floor contact is to activate the floor contact solving steps in your HIKEffectorSetState.
When you call the HIKSetIKSolvingStep() function to set the solving step, you must include the HIKSolvingStepContact and HIKSolvingStepContactApprox steps. These steps are included in HIKSolvingStepAll, so you can simply use HIKSolvingStepAll. For example:
HIKSetIKSolvingStep(MyEffectorState, HIKSolvingStepAll);
For details on IK solving steps, see Solving Selected Body Parts.