# Way to manage instantiation of transform nodes with animated meshes inside

**URL:** <https://forum.babylonjs.com/t/way-to-manage-instantiation-of-transform-nodes-with-animated-meshes-inside/37373>\
**Category:** Questions\
**Tags:** node, gltf, instances\
**Created:** [January 14, 2023, 5:37pm UTC](https://forum.babylonjs.com/t/way-to-manage-instantiation-of-transform-nodes-with-animated-meshes-inside/37373 "2023-01-14T17:37:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![paleRider](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/palerider/32/7774_2.png) [@paleRider](https://forum.babylonjs.com/u/paleRider)\
**Post date:** [January 14, 2023, 5:37pm UTC](https://forum.babylonjs.com/t/way-to-manage-instantiation-of-transform-nodes-with-animated-meshes-inside/37373/1 "2023-01-14T17:37:02Z")

</div>

Hi there:

After importing an animated mesh from a GLTF in my scene, and instantiating its root transform node using the API `Node.instantiateHierarchy`, I realize that the animation group in the model is only affecting the original mesh, but not the instances.

This is a GLTF with a baked animation, not skeletons at all. We’ve tested that with an animated model with a skeleton, all works as expected.

Sadly, I can’t make a PG because the assets are strictly confidential.

Any idea or tip on this?

Thanks for your time.

P.S: Maybe is a more affordable way to implement it via Asset Containers?

---

<div class="post-metadata">

**Author:** ![paleRider](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/palerider/32/7774_2.png) [@paleRider](https://forum.babylonjs.com/u/paleRider)\
**Post date:** [January 15, 2023, 11:11am UTC](https://forum.babylonjs.com/t/way-to-manage-instantiation-of-transform-nodes-with-animated-meshes-inside/37373/2 "2023-01-15T11:11:54Z")

</div>

Hi there everybody:

In order to ease the resolution of this issue, meanwhile not violating the NDA of this project, we’ve managed to generate a really limited version of the “offending” model, incorporated to [this PG](https://playground.babylonjs.com/#R2XMCV).

Please note that, against the expected behavior, only the original doors open but not the instances.

Of course, we’re very sure the problem comes from the GLTF, so any help in that direction will be welcome, so my 3D artist colleague @joie can fix it.

Thanks for your time.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [January 16, 2023, 1:39pm UTC](https://forum.babylonjs.com/t/way-to-manage-instantiation-of-transform-nodes-with-animated-meshes-inside/37373/4 "2023-01-16T13:39:23Z")

</div>

I’m not sure there’s a way to do that automatically (but I’m no animation expert). You can do it quite easily, however, by cloning the animation group:

> **[Babylon.js Playground](https://playground.babylonjs.com/#R2XMCV%231)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

cc @PatrickRyan in case I missed something.

---

<div class="post-metadata">

**Author:** ![paleRider](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/palerider/32/7774_2.png) [@paleRider](https://forum.babylonjs.com/u/paleRider)\
**Post date:** [January 16, 2023, 5:28pm UTC](https://forum.babylonjs.com/t/way-to-manage-instantiation-of-transform-nodes-with-animated-meshes-inside/37373/5 "2023-01-16T17:28:56Z")

</div>

Good evening, @Evgeni_Popov, and thank you very much for your invaluable help on this topic.

Your solution works flawless.

Certainly it had confused me the fact that using other asset it works out-of-the-box (w/o the need for cloning the original animation group at all), as you can see in [this different version of my original PG](https://playground.babylonjs.com/#R2XMCV#3), so I thought something was wrong with our GLTF.

Thanks for your time.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [January 16, 2023, 5:50pm UTC](https://forum.babylonjs.com/t/way-to-manage-instantiation-of-transform-nodes-with-animated-meshes-inside/37373/6 "2023-01-16T17:50:23Z")

</div>

It’s a bit different because in your second example the meshes have a skeleton attached to them. And when instantiating, the `skeleton` property of the source mesh is copied to the instances. So, when the skeleton is animated, as it is shared by all instances, they are properly animated.

In your first example, the animation is directly applied to the source meshes themselves. If you want to animate the instances, you need to copy the animations and target them to the instance.

---

<div class="post-metadata">

**Author:** ![paleRider](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/palerider/32/7774_2.png) [@paleRider](https://forum.babylonjs.com/u/paleRider)\
**Post date:** [January 16, 2023, 6:22pm UTC](https://forum.babylonjs.com/t/way-to-manage-instantiation-of-transform-nodes-with-animated-meshes-inside/37373/7 "2023-01-16T18:22:34Z")

</div>

Thanks for the explanation, @Evgeni_Popov.

We were thinking that something like that is what was happening, but like to be sure about.
