Implementing root motion


I’m trying to make root animation work
(I.e :
The character position is animated, and being part of the animation makes the movement more synchronised. A basic linear animation of the position wouldn’t fit )

So basically, i’m trying to remove the X, Z position animation of the root bone, and instead apply it to the mesh position. And so on, every frame.

Is there a built in way for this? I’m not comfortable enough with babylonJs core to try the hacky way
If you have any other ideas for workaround, i’m interested as well !

Thank you

Edit: Base playground link :

Hello and welcome

if you export your data to glb, you can load them in babylon.js and get a node link between your bones and actual meshes.

Each bone will be link to a TransformNode making it easier for you to control the root node

Maybe you can create a repro in the Playground so we can hack around?

Doc: Using External Assets - Babylon.js Documentation


I’ve added a playground, with corresponding assets
please ask if something is missing
Edited - Added more details
What i’m trying to achieve is to apply root motion on the ‘Throw’ animation and then, blend it with the ‘Run’ animation (Run animation is on place, so no root motion here, just linear update of position)

Thank you

Ok so first you need to find the transformNode who is controlling the root bone (you can use to get a view of the nodes and their controller nodes)

Then you need to go through the animation and extract the x,z animations

Does it make sense?

1 Like

Thank for you answer @Deltakosh

At this moment, i’ve only been able to export animations from blender as animationsGroup, I can find a animations: [] object on the root transform node, but can’t figure out anything related to animationsGroup so far.

Should I focus on saving as one animation track instead of using animationsGroups ?

With animationsGroup, here is what i’ve done so far, I was able to change the animation target with this code:
For some reasons it’s kind of working when the ‘Throw’ animation is played a second time. But now, I miss the old Y animation so the mesh is half burred in the ground (Cause of key.value.y = 0)

So I tried to duplicate and modify the TargetedAnimation for (RigPelvis, Position) in order to split it in two:

  • One targetedAnimation for the X and Z positions of the mesh
  • One targetedAnimation for Y position of the rootBone (RigPelvis)

It’s working great, but animating the root bone position does not allow some additional control on it. Do you have any idea about animating in order to ADD the animation delta position to the root bone?

In order to ADD animaiton as a delta I would recommend creating a parent for the root bone. So when the root bone will animate it will do it relatively to the parent where you can control the overall position

Yo @TheTrope … Did you ever get this root motion working ???

What are doing for Rotation… Doesn’t the animation also have rotation of the root bone transform… ???