Load animations for .glb model from different .glb file

Hello,

we have 20 different models in .glb with 1 animation and all auto-rigged from mixamo.
Now, we want to create a animation-library and add it next to the model to our bablyon.js project, so the model loads his animations from this separated file.

The background is, if we add 100+ animations to the model, it will grow to 50-100mb and loading time will be much higher in the beginning. Furthermore, we would need to add new animations to each of the models separately in blender, rather then giving all 20 models a shared animation-lib.

I tried adding two BABYLON.SceneLoader.ImportMesh into each other, load the animation files from the second model to animate the first model. But only the second model was doing the animation. Also, both models were visible at the same place.

Any idea how to do this?

thanks for the help! :slight_smile:

1 Like

Hey and welcome!

This should work if models are compatible. Can you share a repro in the Playground so we can have a look?

In the meantime, I managed to load animations from different files. They also work fine if the model is the same. https://www.babylonjs-playground.com/#UGD0Q0#86
For this example, I reused the original file multiple times, since it has animations included already.
But I tested it also with other files and it works.

Is it possible to pre-load this file and apply it to the main-model, once its needed?

like:

  • mainModel.glb is loaded with texture
  • animation.glb with 100 animations is loaded
  • when I need an animation, I will load it from the animation.glb

best

1 Like

Preload does not really exist but you can import the glb into an asset container to achieve the same outcome:
Asset Containers | Babylon.js Documentation (babylonjs.com)

1 Like

Hmm, not sure how to reuse the asset container after loading the model into it.
How can I access the animations?

Hi @dimitrios! Welcome to the Babylon Family!

Perhaps these videos can help:

1 Like

Awesome! I take a look! Love your enthusiasms in the videos btw. :smiley: