IK / FABRIK blueprint tutorial for proper foot placement with capsule collision

EDIT: I have discovered that the built in crouch function changes the height of the players capsule, so the method I used of getting the capsule half height on construction of the actor will not work right when crouched, to fix this simply get the capsule half height in the IK trace function and apply it directly.

The blueprint does not have smoothing. See post below for foot angle on sloped surfaces.

The method used is a slight variation of the one included in the content examples. If you’ve tried that one, you may have noticed that it does not work on objects like stairs which are below the characters collision capsule and one or both feet remain hovering in the air and are fully stretched out. To fix this we are going to move the characters hip so that the entire character moves down relative to the capsule and the feet are able to touch solid ground.

The first step is to setup your characters skeleton properly, your legs can only be made of two bones from the ankle to the knee and from the knee to the hip; the bones in the feet and toes do not matter. Your bones must be parented in the traditional fasion, the hip bone is after root and moving the hip should move the entire skeleton: b-hip>b-right-thigh>b-shin>b-foot>b-toe.
You will need two knee target bones (these do not seem to be necessary for FABRIK nodes) and two feet target bones, these bones MUST be parented to the root bone so that they do not move when the IK system tries to reposition the feet. When you make your animations, make sure your feet target bones sync up with where your feet actually are in the key frames and your knee targets are always in front of where your knee is supposed to be pointing, the easiest way to do this is to have them copy the transforms of the controls in your actual animation rig.

See the image below.

Once the skeleton is setup properly and imported into the engine with animations you need to add sockets to the knee targets and feet targets.

Next you will create from top to bottom what is shown in the image in the attachment.

An explanation of what is happening, take note that all calculations are in WORLD SPACE:

On construction of the actor we get the characters capsule halfheight and calculate how tall 1/4 of the capsule is.
At every rendered frame we call our custom function IK foot trace in the characters event graph for the right foot and then the left foot.
The function gets the xy location of the socket for the foot target and offsets the z to 1/4 of the capsules height, it then traces straight down to a point determined by the input tracedistance which is calculated from the midpoint of the capsule.
If the trace hits something the hit location is sent out to be used for repositioning the foot, also the vertical offset between the bottom of the capsule and the hit location is calculated to determine how far the characters hip should be offset so that their feet can reach.
While doing the above, the function draws a box to show where the foot socket is and a sphere to show where the hit location is.
After the function is finished, in the event graph the hitlocation (effectorlocation) is offset by some z value so that the mesh doesn’t sink into it’s ankle where the foot bone is.
The hipoffset from each foot is then compared to see which one is the biggest, the biggest one is sent to the animation blueprint and used to lower or raise the characters hipbone in relation to the collision capsule.
In the event that the trace does not hit anything, for example when the character is on a ledge and one foot is sticking out over the ledge, the IK for that foot is deactivated by setting the alpha to 0.

In the animblueprint eventgraph, the hipoffset is smoothed using interpolation so that when running up stairs the character doesn’t rapidly shake up and down, it’s then turned into a vector for the actual bone control node.
Anim notify events placed in the walking animations activate or deactivate the IK for each foot when the characters foot makes contact with the ground or lifts off; if the IK was always active the feet would never leave the ground and it would look like the character was sliding their feet back and forth. This causes issues when the character goes from moving to standing still, the IK doesn’t turn on properly through anim notifies and the feet positioning becomes wrong, so the speed of the character is checked to see if it’s almost 0 and then the IK is activated manually for each foot.

In the animgraph we use a transform node to offset the hip bone and two IK nodes for the feet, take note that your knee target socket locations are used for the joint targets in the IK node; if you don’t want to make knee targets, you can use the FABRIK nodes instead which work just as well.
In the IK nodes, your effector bone should be the foot and space is WORLD SPACE.
In the FABRIK nodes, your tip is the foot bone and root is the thigh bone.


This is excellent! Next, you need to take the Impact Normal of each trace downward, get the rotation XVector, combine a 90° pitch offset with it (maybe , it depends on how your feet bones are built), and use it to adjust the angle of the feet to be flush with the surface.

That’s the plan, but I’m not so sure it’s that simple; the foot angle is in bone space and the normal is in world space. I’m going to have to experiment a bit.

You should be able to manipulate the foot bone in world space. You need to combine 3 rotators: first, you need to align the foot’s yaw to the rotation of the player capsule, then offset that yaw to match the proper yaw of the idle stance (assuming the player stands with his feet fanned slightly), then adjust the pitch/roll based on the normal of the downward trace.

Hi Guys,
We have just done this; A single drag and drop node

Maybe of interst

That’s cool, but I’m doing this mainly for people working with free tools.

I have foot roll and pitch working, it was simpler than I thought. Take the hit normal, put it into your animblueprint and calculate by how many degrees it is offset from a vector pointing straight up. Set your transformation node to use your foot bone with additive and world space.

How’s progress on your IK solution coming?

This is awesome - moving the mesh down below the capsule is the element I was missing to get good foot IK. Thanks man, this is really helpful.

I’m not actually working on a standalone feature, the mess you see above is the solution and the logic needs to be customized for every character. Right now there is an unsightly issue of the feet appearing to ‘snap’ to the IK locations as the IK alpha jumps from 0 to 1, if you want to fix this you can find a way to interp that value on event update animation.

Hi. First of all thank you for posting this. I am having a little bit of trouble getting it to work though. Mainly because some things aren’t visible on the screenshots. Would it be possible for you to upload the files? I am sure this would be helpful for a lot of people. :slight_smile:

This is awesome! Would be nice to see what is in the Transform Bone Nodes and Two Bone IK nodes in the Animgraph. Mine does not respond as expected…

Just popping by to say, I used this, though in a slightly different fashion. Rather than using additive rotation on the foot poses, I use a world rotation specified by the target rotation of the bone from the anim, combined with the normal rot from the trace. The advantage to this is that poses work better extended to extreme lengths (otherwise, when using additive, a very extended leg tends to rotate the foot itself since that’s a child bone; by forcing the rotation to always be the target rotation of the anim, offset by the surface rotation, in situations where the leg is bent in the extreme, the foot’s position relative to the anim on flat ground is consistent. If it were pure additive, we’d add the rotation to the anim’s rotation, which is already offset BY the leg rotation, sometimes leading to disconnected toes or weird rest positions for feet).

I also forewent the BP-driven on-off for each foot’s IK, and instead created three variable curves which all my anims use; LeftFootIK, RightFootIK, and TorsoIK; these all contain a 0-1 range which adjusts how much the IK should weight in for each frame of an anim (the TorsoIK doesn’t alpha blend the location adjust, just a rotation adjust created from the average of the two foot traces; this way, for things like running down steep hills or rolls/other movements which are surface-dependent, I can blend the entire skeleton into a rotation with the surface, then blend out to a proper upright where only the feet/legs are offset). Using weights works nicely for the feet; for things like melee attacks, where a foot might lift slightly off the surface, I can go to a weight of 0.5 or 0.8 or thereabouts, which lets the foot “lift” with the anim but still causes that lift to track the surface somewhat, avoiding situations where lifted legs might clip through steep terrain.

It works remarkably well, as long as you’re willing to fine-tune each anim on slopes of various steepness from all directions to make sure the blend weights always feel right.

Hi Nabiul and Rythm,

I have got this working (Somewhat) However for complete clarity can you show or tell what is meant to be in each node listed in the picture i have tried both ways and results aren’t as expected. I previously had an issue with Hipoffset which I have now resolved… But this is the last hurdle in my debugging.

Can you let us know how you did it?

I would greatly appreciate it.


I’d be happy to show you how mine look, but I caution you that what I’m doing isn’t necessarily going to work for you because I use a special way of generating the rotations for the feet (which samples the anim’s desired bone rotation for the foot, combines it with the world rotation of the impact normal of a secondary box-trace designed to prevent the foot from rotating to match impacts inside crevasses or dips, and then forcibly overrides it) and torso (which uses an average of the two foot rotation values, and then drives the rotation of the entire mesh using conditional partial weighting which favors making the actor pitch up/down on a slope rather than rolling left/right), and because I drive my IK weight using anim curves so I don’t blend the locations the same way as you do.

I have to say Rhythm because of your previous help i manage to debug the code and what was going on with it :), i manage to get the hip offset working, I’m just at the stage where the knee isn’t bending… Or when i use worldspace in the IK or FRABRIK nodes his feet keep snapping to the middle however when i use bone space he walks correctly but knee’s do not bend on stairs however his hip attempts to move up and down. I think its down to these nodes.

Your BP sounds good but technically, I would like what you have if you want to PM it to me showing me what is in the nodes for you, then I will go through each part working out which each node does.

Thanks for your continued help Rhythm.

If you get everything working, it would be amazing, if you could upload a small project featuring this. This would be extremely helpful.

I have some problem with the system in v. 4.6 the problem is shown on the pictures below

And the blueprint itself:



And how do i fix so it dosn’t move the character up after you stop when walking up and move the character down after stop when going down?

Hi nabiul

Thank you for the tutorial, it works very good. You totally can make a surf game with this :))

I have a couple of questions.

How do you calculate the knee direction vector? I took the value from Content examples and modified it a little bit, but it still look weird.

I have a little bit bumpy movement when running steep slopes, especially running down. Do you have that too? I didn’t exactly followed your tutorial, so I’m asking if it’s because of my values of offset and interp speeds or you have it too?

Does this work in 4.6?

I swear I followed it as exact as I could, but the legs go funky in world space. They stretch, shake, do weird things. Also, when I compile the MyCharacter Blueprint, I go and compile the animblueprint. But when I go back to the my character blueprint, it says I have to recompile it. It doesn’t matter which I do first. It just keeps asking me to compile. They are never both compiled.

I have a feeling it has to do with the Casting to AnimBlueprint in the MyCharacter Event Graph before you do the trace. Tried to upload a picture, but it keeps giving me a database error.

If anyone has a suggestion, it’s welcome!


> Does this work in 4.6?

I used 4.6 and it works, but I didn’t followed exactly, I didn’t use debug node and I had anim blueprint read variables from character blueprint, not vice versa like in tutorial. Also, I used curves for alpha instead anim notifies. It works very well when character is idle, but movement is a little bit strange when running up/down stairs.