IK system fixing up and downhill running without whole new animation sets?

Hey all,

I’ve been trying to come up with different kind of systems that will fix IK system issues for our character when he’s running up or downhill.
We have quite an extensive animation graph, and creating new animation offsets for everything is going to be too extensive.

Anyone has some solutions, or tips for me that I could try?

Custom animation node or blend spaces.

yes, I evaluated that option. But like I said, that’s going to be too expensive for us to do as we have a ton of movement cycles with different timings.

If you know C++, you easily can make custom animation node based on TwoBoneIK. The idea is to use Ground Z coordinate as a parameter instead of effector location. Using the Z coordinate, you can calculate required effector location inside of animation node (i.e. after movement animation).

Well, I don’t know C++ myself, but there are plenty of people here who can help me with that. However, where would you get the parameter value from? You still have to grab the value and then apply it as a change. Correct me if I’m wrong, but I don’t really see much of a difference in there.

The way I currently approach it is to calculate the distance between the ground hitpoint and the current ik bone location where the Z height is equal to the root bone. Then I take this vector length and inverse transform it with the IK bone’s space. I then take this value as the effector location on the two bone ik node which is set to bone space.
So the height difference is added on top of the current animation.

I mean, if you could explain to me how to kill the tiny tick delay you have between grabbing information and applying the information. By all mean I’m dying to know. I’ve been stuck on this thing for days now. (it’s already set to the pre-physics tick group).

Normally, desired foot location is calculated in then Event Graph, then Anim Graph plays animation, then TwoBoneIK node returns the foot to the position calculated before the animation.
To workareound it,

  1. trace to get ground Z coordinate in Event Graph
  2. apply animation in Anim Graph
  3. then apply a custom animation node very similar to TwoBoneIK, but taking Ground Z (float) value as a parameter instead of Effector Location (Vector). Iinside of this node (i.e. after animation) calculate desired foot location and apply it.

hmmm, I think I get it. It’s basically the same as applying the Z offset data onto the IK in bone space. So the animation stays the same, you just give it a fixed offset. Downside of bone space is… well bone space, the offset would not just be Z worls space, and an inverse transform won’t fix it.

So basically your parameter adds the Z offset in world space on top of the current existing animation, right?

You can use world space too and convert it to local space similar to how TwoBoneIK itself do it.

local space? You mean component or bone space?
And converting it is not going to work as it requires getting and applying data, beating the whole purpose of your idea where you eliminate the grabbing data.

Create animation node similar to TwoBoneIK, but instead of Vector EffectorLocation parameter create Float GroundZ parameter.

Inside of this custom animation node you have

  1. current foot position (from animation input)
  2. ground Z coordinate (from input parameter) in world space (or in component space, doesn’t matter)

So you need to:

  • convert current foot position to component space - TwoBoneIK does the same job
  • convert ground Z coordinate to component space using the same code
  • instead of EffectorLocation use foot position with Z coordinate replaced to GroundZ. It gives you EffectorLocation based on after-animation foot location but adjusted to new ground Z coordinate.

Everything else is like in TwoBoneIK node.