Transfering motion from pelvis to root

What is the best/easiest way of doing it? An automated solution would be welcome.
What I want is to transfer the motion from the pelvis to a stationary root (and then remove that motion from the pelvis) so that i can have root motion in unreal for example.
I read somewhere that the graph values can be copy pasted from one bone to the other, but I think that only works when the local orientation is the same for the bones… anyway I tried it… it was working but glitchy a bit.
The way I can do it is this:
-clear parent on pelvis to root
-add copy location from pelvis to root
-reestablish parenting to root
-add copy location from root to pelvis (worldspace ofc)
-bake again

any idea/script to make this faster?

Would I be right to think that your building walkcycles/runcycles with the character moving forward, and then converting them to walking in place?

If so… I wouldn’t want to make the hips static… they need some up and down, rotation, and even some moving backward and forward within the walkcycle.

What I would recommend is selecting your hips, going into graph editor, clicking the arrow icon so that you only see the graph for the selected bone, finding the graph that is the movement forward, and using shear (space/F3 - type shear) and adjust so the hips are in the same place at the beginning and end of the walk.

i don’t want in place animations, I want the root to follow the character as it moves around.
this is useful when you want root motion animation in a game engine, where the movement is based on the animation itself and not on scripts…

I said in the first post that copy/pasting the graph values from the hip to the root is glitchy and I thought it shouldn’t work, but apaprently it does, at least in those animations I tested, so probably that’s the best way to do it