How to copy the skeleton and animations to another models?


Hi everyone, in the above playground I have shown how I load a model with animations and clone it several times in such a way that I can independently use the animations on each of the copies. My need is that I have models with different looks, which supposedly use the same standard humanoid model, as far as the skeleton is concerned.

And a lot of the animations that I want to put on my models duplicate each other, so if it is possible, I would like to put the animations into one model, and then in the code distribute them to the rest of the models.

With just copying animations group I think I can handle, but I have no idea how to copy skeletons and connect them to another model.

I would be very grateful for any help.

PS: It is also possible to approach this problem from the other side, and then really what I would like to do is to copy the model the same way as it is done in the provided playground and change only its appearance, but keep the animation, etc.

Here is one of possible methods -
More examples here - Using animation from Mixamo with Ready Player Me Avatar - #3 by labris


This has been discussed quite a bit around on the forum:
Animate multiple Ready Player Me avatars in the same scene - Questions - Babylon.js (
Loading character with animations to scene and cloning it with animation groups - Questions - Babylon.js (
Copy animationGroup with skeleton - Questions - Babylon.js (
Attaching GLTF/GLB animations-only files to GLTF/GLB 3D models - Questions - Babylon.js (

Hopefully these help you, and if you have any further questions feel free to update this topic :slight_smile:

1 Like

Hi Guys, thank you very much for the information provided, it helped me to copy the animation to the new model with the same skeleton, as confirmed by the below link playground link:

Unfortunately, when I tried a similar approach on my game models, it gives me an error when transferring targets to another skeleton, at the end bones are lost on the main nodes.

This is the error I get:

and that’s a part of my code:

I have spent the last 2 days trying to figure out what is wrong, but it is beyond my knowledge

Could we see a playground example with your game models?

I’m not sure if I can do it, because these are bought models

As for the earlier question, it is no longer valid I handled the case when the index is not found and assigned in such a case manually found root of model copy.

Unfortunately another problem arose…

When cloning the skeleton, the nodes assigned to the bones point to the original model instead of its copy, can I somehow redirect these bones to the cloned model?

this is what the example loaded model looks like:


Does the cloned model have the same structure?

Yes it does, I managed to redirect bones linkage with this code, not sure if it’s the most optimal way but it seems to be working

  const descendants = unitRoot.getDescendants(false)
  const cloneDescendants = unitRootClone.getDescendants(false)
  const descendantsMap = new Map();

    for(let index in descendants){
        descendantsMap.set(descendants[index], cloneDescendants[index])

    for (let bone of unitSkeletonClone.bones) {
        if (bone._linkedTransformNode) {
            bone._linkedTransformNode = descendantsMap.get(bone._linkedTransformNode);

I am now wondering about the current structure of my nodes, because before adding animation to my game I was doing everything on pure meshes without any descendants.

Now because of these transform nodes everywhere I would have to make some changes in the code, do you see any contraindication against me removing KnightAnimatedNode and instead pull Character_Male_Sorcer_Mesh level higher in place of it?

It’s really hard to say it without being able to look at the meshes themselves, but I wouldn’t mess with the transform nodes. The RPM example has the same structure, and it works fine, so it’s not the transform nodes’ fault Retargeting Animation Group | Babylon.js Playground (

Thank you @carolhmj for your answer, in that case I will leave the structure as it is and make the necessary changes in the code when it comes to moving models, etc. Could my earlier problems and the workaround I had to do be due to the fact that I am cloning the model and the skeleton outside the asset container? My workflow looks as follows:

  1. loads a single model for each unit type through the asset container and adds it to the scene
  2. connects to server
  3. gets information from the server about the number and types of units to be generated
  4. outside the asset container through the scene gets to previously added models and clones them set number of times

There shouldn’t be any difference in using the asset container or not, as it’s just a convenience object