Better root motion retargeting for persona. (algorithm)

I’d like to have better root motion retargeting for persona animation system.

Seeing that for now my threads on the topic are unanswered, I assume that the feature isn’t present and “sliding feet” problem can’t be solved in general case when animation is transferred to different skeleton.

It is probably possible to implement better root motion transfer using something like this:

(rough algorithm idea)

  1. While retargeting animation, track position of limb ends - hands and feets. I’m talking about ends of bone chains there, “hand” and “foot” bones, specifically, not about whole chain.
  2. If in original animation the limb has not been moving in world space and/or it is located close to the ground, assume that it serves as “anchor” for animation (meaning model stands on that limb right now) and its world position in retargeted animation should also be unchanged.
  3. In retargeted animation, once limb starts working as anchor, compute root position relative to the anchor. Meaning:
    3.1. Calculate modified skeleton pose.
    3.2. Grab “anchored” bone
    3.3. Move the whole skeleton in such way that world position of anchored bone will be the same as in the last frame.

Issues with the algorithm:

  1. Multiple anchors. Not sure what to do in this case, perhaps compute average position?
  2. No anchors. In that case it would make sense to calculate relative root motion (relative to previous frame) using scale ratio based on model leg length.
  3. Very different limb proportions (gorrilla doing cartwheel move). In that case limbs may sink into ground.