HumanIK tools implemented in Stingray let you quickly set up foot pinning on your game characters, ensuring that the feet do not slip through the ground even on dynamic terrain. With HumanIK floor contact, the feet angle and position themselves dynamically, and the rest of the body reacts naturally to the foot position, maintaining a realistic range of motion.
This topic explains how to set up floor contact using the HumanIK plug-in. Floor contact lets you adapt locomotion clips (or entire animation controllers) live, so that they take into account the terrain topology.
For example, an animation clip recorded on a flat ground can be warped to play back properly on a slope, on bumpy terrain, or on stairs.
(Note that this topic does not cover all information required for setting up the entire HumanIK character, including movers/physics.)
In Maya or MotionBuilder, characterize your character model using the Character Controls.
Note: It's important to make sure the characterization includes feet markers if you plan to set up floor contact. The feet markers will ensure precise feet contact in the game engine by taking into account the thickness of the mesh around the feet joints; markers should also be included for the hands if you plan to enable floor contact on hands (when the character is crouching for instance).
In Stingray, create a new level. See Create or load a level.
Import the characterized character, and during the import process make sure to select New or update skeleton for Skeleton and enter a name to create a new skeleton.
Don’t place the character unit in your level yet.
Tip: You can confirm the model is properly characterized by checking the 'content/units folder of your project. When you import a characterized character, Stingray creates a .character file ("CharacterName.character").
Import an FBX file containing your character animation clip. In the Import FBX options, turn off other options except for Animations and select the target skeleton created earlier for the character.
Most Autodesk content creation software (3ds Max, Maya, Maya LT, MotionBuilder) comes with some generic motion capture clips, or you can purchase clips from Creative Market. These clips usually already contain characterized skeletons, including foot markers.
Set up an animation controller for the motion capture clip.
Drag the animation clips from the Asset Browser to the Animation controller. The controller will create the necessary states for these clips.
Add events to control the animation clip states during runtime.
Your character starts to animate in the Asset Preview.
Load the created new level. (Create or load a level.)
Place the character asset in the level. (Drag & drop from the Asset Browser.)
Populate your scene with geometry representing the floor (scaled cubes for instance).
Set the floor objects (cubes) to act as collision objects:
Double-click a cube to open the Unit Editor.
Right-click the cube object in the hierarchy view panel and select Create Physics Actor.
In the Properties panel, under Physics, set Actor Template to Keyframed.
Enable HumanIK (disabled by default).
You can control HumanIK using HumanIK flow nodes. Both level flow graphs and unit flow graphs are supported.
You can enable HumanIK in the level flow graph, when the Event > Level Loaded event gets triggered.
Equip your character with all constraints it might use during its lifetime - in this case, the floor contact related constraints (the Full Body Plant and the Legs Plant constraints).
This part is usually done in the unit flow graph, when the Unit > Unit Spawned event gets triggered.
Alternatively, you can enable and set up HumanIK through LUA.
Set up these flow nodes and test your level:
Add Input controller node and set Animation > Send Animation Controller Event to trigger the motion clips for the character using the input controller while level testing.
Tip: At any point, you can smoothly enable/disable the floor contact constraints by setting their “Blend Alpha” values to 1/0. This can be done using the HumanIK > Character Tune Constraints > HumanIK Set Blend Alpha flow node. Disabling the constraint and re-enabling it might be useful when dealing with jumps, for instance.
Add HumanIK flow nodes to test and tune IK constraints and retarget your characters and set a look at constraints.