Setting Up Ground Conforming

Section 1: Control Rig

We will be using the Titanosaur as an example creature.

3. Import the Titanosaur hierarchy.

4. Open the Preview Scene Settings tab and select Titanosaur as preview mesh.

5. Unplug the Forward Solve node so that you can see the skeleton in reference pose.
Select all the bones that you want to be simulated. This is the equivalent of adding physics bodies to a selection of bones.

Now drag the selection into the graph and choose Create Item Array.

6. Duplicate the array and replace the old arrays that are commented as “Effector Bones” and “Parent Bones”.

For each effector, define its parent in the parent bones array. The parent bone needs to be one of the effector bones, with the exception of the root bone.

7. Make sure that all “Settings_*” variables have a length equal or greater than the effector bones array.
8. Connect the effector and parent bonres array to the function GroundConform_Constructor. If you get warnings about node run limit, increase it in the Class Settings:

9. Connect the Forwards Solve again.

10. Adjust Settings_TraceRadii until you can see the red collision spheres. Always compile to see the changes to default values. This can be fine tuned later in the map.

11. Go to the Full Body IK node and set “Root” to the hip bone, or the first bone that comes after the root bone. Remove all array elements of the Bone Settings.

Section 2: Hooking up the Control Rig in the Character Blueprints

Creating the AnimBP Linked Graph

2. You can copy-paste the nodes from Sauropod_GroundConform_AnimBP into the new AnimBP.

3. In the class defaults of the new animBP, make sure "Use Main Instance Montage Evaluation Data" is checked. This links montages from parent to the newly created animBP.

4. Select the Control Rig node and set the class to the Titanosaur_GroundConform_CtrlRig.

4. Right-click the Anim Instance node and choose “Create variable”. Click the Eye icon to make the variable “Instance Editable”. Compile and save.

This variable must be named AnimInstance so that the linked anim graph works. It must also be marked as editable or the editor will crash.

5. Copy-paste the event graph of the Dodo_GroundConform_AnimBP into Titanosaur_GroundConform_AnimBP. Then right-click the “Set Variable” nodes and choose “create variable”.

Note: Some dino animBPs may have extra vars in their update function, but the ones listed above are mandatory to get basic functionality working. 

6. In the Anim Graph, to connect the new variables “isBeingDragged” and “bSwimmingMovement”, etc. to the Control Rig. You will first have to select the Control Rig node and choose “Use Pin” for the inputs to be exposed. Also make sure these variables are set to 'instance editable' in the control rig itself, else the "Use Pin" option will not be available.

Dino Dragging Setup

We are also able to drag dead dinos using GroundConform so that their tails/limbs all use proper IK. The setup is very simple

Torpid Conforming Setup

Because we're using the same GroundConform logic with a dino's torpid state, we need to make a few changes to the graph and animation assets.

Add an EnableGroundConforming metadata curve to the dino’s torpid idle animation asset. This ensures the animation won’t deviate from its conformed state.

In the Torpid-Eat animation, set the additive settings to “Local Space” using the dino’s Torpid Idle for the base pose. Also add the EnableGroundConforming metadata curve. 

In the Torpid-Eat-Montage, set the slot to TorpidEatGroup.TorpidEatSlot. If this option isn’t listed, go to Window > Anim Slot Manager, and make a group/slot using that naming convention. This will require you to save the skeleton! 

Here is a general overview of what your AnimGraph should look like with everything implemented. The torpid logic is most variable to change -- For example, in the photo above, the Allosaurus has its own TorpidArmPose, which only affects the left arm. Very case-by-case.

 Setting up the Character_BP

Link the Anim Graph

Then hover the mouse over the AnimBP to find the Parent Class.

Another way to find the parent class is to open the Titanosaur_AnimBP and click at the edit button in the upper right corner.

2. Check if this parent AnimBP has a GroundConform Linked Anim Graph before the Output Pose. If it doesn’t, you will need to create a GroundConform_AnimBP for the dino of this AnimBP.

For example, let’s say we are working on the Basilosaurus and the parent class DinoBlueprintBase_RootTransform does not have the linked graph added yet. It uses the Ptero mesh so now we have to create an AnimBP called Ptero_GroundConform_AnimBP and put it into Ptero/Rig/. To use this as a placeholder, add the AnimInstance variable and make it editable. Add an Input Pose node and connect it to the Output Pose. Now you can place this Ptero Linked Anim Graph in the DinoBlueprintBase_RootTransform AnimBP and set the Tag to GroundConform. Now that we have the linked graph in the parent class, we can continue.

Wrapping Up

Let's do a quick checklist on the parent class, to make sure it's ready for directional deaths and death conforming.

2. In the Event Graph, make sure you have this code before everything in the Animation Update function, as well as Event Blueprint Initialize function. We use this to link and unlink our Groundconform_AnimBP from the parent graph when needed.

Lastly, we just need to make sure the dino's original animBP is adjusted. In the class defaults, set the "Ground Conform Instance" to the new Dino_GroundConform_AnimBP. 

6. Test if everything is hooked up correctly. Play in editor, spawn a dino and kill it to see the ground conform system activate. Also test if groundconform works with torpid states:

cheat spawnactortamed /Script/Engine.Blueprint'/Game/PrimalEarth/Dinos/Titanosaur/Titanosaur_Character_BP.Titanosaur_Character_BP'

cheat killaoe tamed 10000

To test torpid states:

cheat setmytargetsleeping 1

cheat setmytargetsleeping 0

cheat gfi berry_a 100 0 0 (to test eating anim)

To view the debug draws of the control rig, use the command:

a.AnimNode.ControlRig.Debug 1

 Now that everything is working in PIE, it is a good time to adjust the control rig settings.