Answering my own question:
I was right about feet bone position difference (UE4 & UE5 mannequins), but I didn’t realize, that while UE5 mannequins feet are getting snapped to a position where UE4 mannequins feet bones are, the root bone remains in the same position. The exported animation skeleton will look like this:
So this is what is actually causing problems like floating feet, because the skeletal mesh origin/pivot is where the root bone is. And the static offset is the way to solve this.
Here is how you can set the static mesh offset (remember to do it for both leg chains). I don’t know if the value of -4 is suitable for all animations, but it worked for my retarget pose & animation combination.
This is how the exported mesh should look like (in terms of feet & root bone align:
The solution above is not fixing all possible cases. I have tried the solution for different animations, and I have found out, that in some animation packages the IK bones are not moving at all (just not animated or broken link, or something…). You can check it by turning on bone visibility and try to play imported animation on UE4 and/or UE5 mannequins, the IK bones should follow feet/hands bones. to make it clear, this is how animation should look like:
And this, is how the animation should not look like on UE5 mannequin:
and UE4 mannequin:
In this case (UE4 mannequin) I have not done anything to the animation, it’s how it looks straight after import from library (it’s from the Generic NPC Pack)
I still have not figured out, how to fix this, or what exactly is going wrong here.
If this is your case, you will still get incorrect feet position when playing, if your animation blueprint contains this node:
As there is custom trace function (FootTrace) which is calculating correct feet position using root bone and IK bones. So, in order to get everything working, you have to either fix the animation sequence (make the IK bones move correctly) or you have to edit the “CR_Mannequin_BasicFootIK” blueprint.
This video has short and concrete instructions on how to fix the IK bone problem once, and for every animation:
If you are using the Third Person Template, and have not done any changes into the “CR_Mannequin_BasicFootIK” blueprint, and related animation blueprints, you must replace these IK bone names with corresponding virtual bone names in the “CR_Mannequin_BasicFootIK” blueprint:
Now, you should be able to retarget any of your animations easily, and the floating foot problem should be solved.
I hope this is clear enough, but ask me if it’s not.