# Load animations for .glb model from different .glb file

**URL:** <https://forum.babylonjs.com/t/load-animations-for-glb-model-from-different-glb-file/20547>\
**Category:** Questions\
**Created:** [May 4, 2021, 8:50am UTC](https://forum.babylonjs.com/t/load-animations-for-glb-model-from-different-glb-file/20547 "2021-05-04T08:50:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dimitrios](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dimitrios/32/15919_2.png) [@dimitrios](https://forum.babylonjs.com/u/dimitrios)\
**Post date:** [May 4, 2021, 8:50am UTC](https://forum.babylonjs.com/t/load-animations-for-glb-model-from-different-glb-file/20547/1 "2021-05-04T08:50:06Z")

</div>

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! 🙂

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [May 4, 2021, 3:11pm UTC](https://forum.babylonjs.com/t/load-animations-for-glb-model-from-different-glb-file/20547/2 "2021-05-04T15:11:21Z")

</div>

Hey and welcome!

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

---

<div class="post-metadata">

**Author:** ![dimitrios](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dimitrios/32/15919_2.png) [@dimitrios](https://forum.babylonjs.com/u/dimitrios)\
**Post date:** [May 4, 2021, 3:52pm UTC](https://forum.babylonjs.com/t/load-animations-for-glb-model-from-different-glb-file/20547/3 "2021-05-04T15:52:51Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [May 4, 2021, 4:13pm UTC](https://forum.babylonjs.com/t/load-animations-for-glb-model-from-different-glb-file/20547/4 "2021-05-04T16:13:47Z")

</div>

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)](https://doc.babylonjs.com/divingDeeper/importers/assetContainers)

---

<div class="post-metadata">

**Author:** ![dimitrios](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dimitrios/32/15919_2.png) [@dimitrios](https://forum.babylonjs.com/u/dimitrios)\
**Post date:** [May 4, 2021, 4:43pm UTC](https://forum.babylonjs.com/t/load-animations-for-glb-model-from-different-glb-file/20547/5 "2021-05-04T16:43:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![PirateJC](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/piratejc/32/1003_2.png) [@PirateJC](https://forum.babylonjs.com/u/PirateJC)\
**Post date:** [May 4, 2021, 5:29pm UTC](https://forum.babylonjs.com/t/load-animations-for-glb-model-from-different-glb-file/20547/6 "2021-05-04T17:29:15Z")

</div>

Hi @dimitrios! Welcome to the Babylon Family!

Perhaps these videos can help:

[![](https://img.youtube.com/vi/fZajDLsLJKg/maxresdefault.jpg "Interactive Hex Tiles: Part 1 - Using Asset Containers") ](https://www.youtube.com/watch?v=fZajDLsLJKg)

[![](https://img.youtube.com/vi/iuRVlwOyv6k/maxresdefault.jpg "Interactive Hex Tiles: Part 2 - Playing Animations") ](https://www.youtube.com/watch?v=iuRVlwOyv6k)

---

<div class="post-metadata">

**Author:** ![dimitrios](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dimitrios/32/15919_2.png) [@dimitrios](https://forum.babylonjs.com/u/dimitrios)\
**Post date:** [May 5, 2021, 8:26am UTC](https://forum.babylonjs.com/t/load-animations-for-glb-model-from-different-glb-file/20547/7 "2021-05-05T08:26:33Z")

</div>

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