Using Foot Placement Node To Create Adaptive Prone

Introduction


In this tutorial we will be taking a static prone animation and combining this with IKinemas full body IK solving to procedurally generate prone animations that adapt to the surface the character is on.
This behavior can be shown in action here: https://www.youtube.com/watch?v=oPNJNUE70lk
In order to achieve this, the following steps must be carried out and will be outlined in detail below.


1) Set up an Unreal project to include starter material.
2) Get a basic static prone animation.
3) Take a look at the pre-made Character Blueprint.
4) Set up an IKinema Rig.
5) Set up and Animation Blueprint using IKinema Foot Placement Node.
This tutorial makes use of animation and game assets made free through Epic so no extra material is required.


1 - Setting Up The Project


Launch Unreal from the Epic Games Launcher.
Select New Project ->Blueprint->Third Person as shown below.
Make sure you include starter content. This will include a pre-made level and actor with input handling for locomotion.
Make sure the project directory is OK and name your project.
Click Create Project.


 

Once your project is up and running you will notice that there aren’t actually any prone animations you can use for your character.
Luckily epic provide another starter pack which contains a number of new animations you can use with the UE4 mannequin. One of which is a prone animation which we will use. So how do we get hold of it?


2 - Getting The Prone Animation - "Animation Starter Pack"


Open the Epic games launcher again.
On the left, click on marketplace and in the "Search Content" bar, type "animation starter pack"
Select the Animation Starter Pack by Epic Games


 

Download the pack and then you will be able to add the content straight into any compatible project.
In the Unreal launcher again, select 'Library' in the left menu. Here you will see all of your projects and also any assets packs you may have downloaded/purchased in the past. In the 'vault' area you will see the recently downloaded Animation Starter Pack which can now be added to your projects.

 




Click on "Add to project" under the freshly downloaded Animation Starter Pack.
This will bring up a window similar to below.
Select the project you made earlier to add the animation starter pack assets.
If you open your project you will notice a number of new animations have been added.





3 - Character Blueprint


If you have followed the guide so far, your character blueprint and input settings for your map will already be set up thanks to the third person starter content we added at the very beginning.



 

The pre-made character blueprint includes all the necessary nodes to handle movement of your character so no further set up is required here just yet.
If you do not have a blueprint included with your project so far, make sure you included starter content when you first made your project.
Note: You don't have to edit anything in the character Blueprint here just yet. We will be revisiting this in the near future. We will need to change the skeletal mesh of our "mesh component". It currently is set to the skeletal mesh included with the starter content but we will need to change it to the skeletal mesh included with the amination starter pack to ensure the correct animations are available with minimum hassle.


4 - IKinema Rig


When using IKinema, one of the vital steps is to create an IKinema rig. This will be used by the full body IK solver and can be configured to fine-tune the behaviour you get. In the IKinema rig you can add 'tasks' to individual bones as you choose. These bones become 'end effectors' in the IK system. You can give them target positions and full body poses will be generated to allow for these targets to be hit.
We will only be using default values for tasks. Feel free to experiment with the weights and gains to get a feel for how the system works.
For now, in the content browser, right click -> Animation -> click IKinema rig as below.



 

This will bring up a dialogue in which you have to choose the skeleton to create a rig for.
At this stage it is important that the skeleton you chose here corresponds to the one you imported into the map from the Animation Start Pack earlier.
If you have followed the directions so far, you can tell which skeleton is which as below. You want the one on the /Game/AnimStarterPack path.


 

Once you hit OK, You will get a notification about too many bones included in the rig which we will correct shortly, click OK.
Rename the rig as you please (you will need to remember it when setting up the foot placement node in your animation blueprint later) and then double click on the recently created rig file to open it.
Here we will delete excessive bones leaving only the most important ones shown below.





4.1 - Adding Tasks

Now we have to decide which bones we will allocate tasks to. These are bones which we want to use as 'End Effectors' in our IK system. All of the options within the IKinema rig are available for fine-tuning. However, we will only be using default values for the purpose of this tutorial to make it as generic as possible. Below shows our constraint set-up.

The following tasks were added to the bones as follows:


Pelvis – hips task
Chest (Spine_03) – foot task
Head – foot task
Elbow (lowerarm_l/lowerarm_r) x2 – foot task
Hand (hand_l/hand_r) x2 – foot task
Knee (calf_l/calf_r) x2 – foot task
Foot (foot_l/foot_r) x2 – foot task
Ball (ball_l/ball_r) x2 – foot task


13 tasks above were added by right clicking on the specific bones in question -> constraint type -> choosing relevant preset. As mentioned, only default tasks were used here for the sake of highlighting the effectiveness of a simple set up.

Don't be misled by the wording foot task. It isn't necessarily related to the feet it is just a preset position and orientation task for bones, weighted so that they are more likely to be placed accurately according to their target position/orientation.
That is the IKinema Rig set up, now for the animation Blueprint. There we will be combining our starter pack animation with our IKinema rig and the IKinema foot placement node to procedurally generate our prone behavior.


5 -Animation Blueprint

Right click in Content Browser ->Animation -> Animation Blueprint. 



Select the skeleton that you imported with the Animation Starter Pack which we selected when making the IKinema rig. If you have been following closely, it will be the one shown below along the /Game/AnimStarterPack path.



Make sure the animations you are expecting to be there are there to ensure you have selected the correct skeleton asset. The one we will be using is called "Prone_Idle". To check, in the animation blueprint, in the top right select the Animation tab as below.


 


(If the prone animation isn't there, you selected the wrong skeleton when making the animation blueprint. Remake the animation Blueprint).


Go to the 'Graph' -> Animgraph in your Animation Blueprint.
In your Animgraph, right click and search for your Prone_Idle animation and place it.
OPTIONAL: pass animation output into a "save cache pose" then place the cached pose as you need. This is good practice as Animgraphs get more complex.
Right click in your Animgraph and search "IKinema foot placement" -> select the node that uses the IKinema rig you made earlier.
NOTE: if the skeletons selected when making your animation Blueprint and the IKinema rig don't match you wont be able to see a correct option for IKinema rig.
Pass output of saved cache pose into foot placement node.
Pass output of foot placement node into final animation pose.




5.1 - Setting Up End Effector 'Limb Transforms'


Here you want to add each bone you want to perform ray tracing from. If the bones added here have position/orientation tasks then their targets will be set depending on their position relative to the ground.
To do this, click on the foot placement node. In the options group "End Effector", you will See a "limb transforms" option. Clicking on the plus sign will add elements, you need to do this for each element you wish to add.
We will add 13 elements here corresponding to the 13 bones we gave tasks earlier in the IKinema rig set up.




With 13 empty elements created, we will now select the corresponding bone for each one. The bones that need to be added are:

  • head 
  • spine_03 
  • lowerarm_l/lowerarm_r 
  • hand_l/hand_r 
  • pelvis 
  • calf_l/calf_r 
  • foot_l/foot_r 
  • ball_l/ball_r


All of the bones here given position and orientation tasks to ensure they are placed accurately relative to the ground.
Finally, select the pelvis bone in the "hips transform" option, this is required for operation of the solver.




5.2 - Finalizing Foot Placement Node Settings


Right click on foot placement node -> refresh node
This will add a number of new pins onto the foot placement node.
Click on the foot placement node and in the extended settings, search for "Mesh Offset".
This option is ticked by default but since we do not have to worry about any mesh offset, untick this option. It will remove a number of pins from the node.
Remaining on the node, are pins for the alpha value for each task we added as limb transforms.
Their values are 0 by default so change them to a value of 1. This will ensure maximum influence of our IK solving.



5.3 - Final Touches


I mentioned earlier that we would have to revisit our characters Actor Blueprint. This is because the Blueprint uses the skeletal mesh included with the starter content, and not the skeletal mesh imported with the starter animation pack.
Double click the character Blueprint to open it.
In the components tab, click on the mesh component
In the details panel on the right, click on the 'Skeletal mesh' in the mesh sub group
Make sure that the skeletal mesh selected is the one you imported with the animation starter pack (you can see which is which by their path when you hover over)



Last but not least, we need to ensure we are using the correct animation Blueprint that we just made.
In the Details panel still, select Animation Mode -> Animation Blueprint
In the AnimClass drop down menu -> select the Animation Blueprint you made earlier
Hit compile and then run your game. If you have followed along, you will now have full body IK solving taking place for your character.
Notice how the characters whole body aligns with the ground!