Syncing two AnimationPlayers (e.g. gun and hands model)

Godot Version

v4.4.stable.mono

Question

Hey everyone!
I’m currently looking for an elegant way to synchronize 2 different models’ AnimationPlayers.
The models are imported gltf files exported from Blender 4.3.2.

A bit context:
I have modeled and animated a gun and a pair of hands. Their animations were created in a compound blend file that uses linked objects to the standalone models of the hands and gun.

All animations were then individually baked for the standalone models and each action is mirred in both models.
i.e. the gun model has actions named gun_idle, gun_shoot
and the hands have matching actions named hands_idle, hands_shoot, et al.
They perfectly sync.

So now I have both models imported in Godot, everything works well, they also perfectly sync up here in Godot. Peachy.

Now, what I hope to achieve is to create one AnimationTree/StateMachine that handles the entire gun handling logic, simultaneously animating both models’ AnimationPlayers.

Is there a way to do this elegantly?

Haven’t tested it myself but you may be able to create a new AnimationPlayer and sync the animations inside it by adding Animation Playback tracks of the other 2 AnimationPlayers Animation Track types — Godot Engine (stable) documentation in English

You could then use that AnimationPlayer in the AnimationTree

Ohh, that sounds like a solid idea. I’m gonna give this a test.

I’ve currently got it working by exporting the entire library of each AnimationPlayer, then creating a new “combined” AnimationPlayer that imports them all. Then in the AnimationTree, each animation is a BlendTree that combines the 2 matching animation clips with Blend2.

This works, but it’s pretty tedious to do, your solution feels definitely more elegant if it works, as it would allow me to set up the entire package of animations beforehand and then have a much easier time in the AnimationTree.

I will report back, thank you!

It works like a charm!
Thanks a ton, this makes things so much neater and tidier.