How to apply separated imported animation to imported mesh with same amature?

hey, a pleasure to be in this community, I’m new to BABYLON.

MY GOAL
I’m making a web game where players’ meshes are different but share the same set of armature bones and the same set of animations(sit, walk, idle…etc). I want to load meshes and animations separatly in order to save performance from loading large mesh+animation files and save the work of pairing animations to all player mesh variations.

WHAT I TRIED
I was trying to load various meshes( .glb files w/ different details, w/ same armature, w/o animation) with the meshLoader and then load their animations(.glb files without mesh) through the animationLoader. However, animationLoader adds all animation to the scene’s animation group and I cannot re-assign them to new targets(like here).

I looked through the animation documentation and many playground demos, but hardly find a way to do so. https://playground.babylonjs.com/#40TC2G#13 seems somewhat helpful, but I don’t know how to transfer my animation into key values in a JSON.

Any help would be appreciated! Thank you so much!

ps. 3D tool I used is Blender

Hi @Harvey_Li and welcome to the forum

Check this thread : Animation group copy not working in Babylon 5

Maybe this PG can help : https://playground.babylonjs.com/#14GLAR#4

It copies animation from 1 group to another

This works like a charm! Thank you Cedric! :smile:

1 Like

Hi Cedric, I met another issue when using this method. I have an animation that I only want to play once. But each of my animation group cannot be set as loopAnimation = false They just freeze all animations when I do that. Do you know what may causing this? Thank you!

I’m not sure about that. I think the king of animation can help here @Deltakosh

Can you share a simple repro of your issue in the PG?

@Cedric @Deltakosh Thank you guys! Sorry for the late reply. I somehow figured this out. And it turns out to be the animatable weight that I set to zero caused the issue. It’s all working out now. Thank you!

3 Likes