Cloning mesh with skeleton does not clone meshes attached to bones

Hey all, first post here :slight_smile:

First of all, a big thank you to all the incredible developers that power Babylon! Also, big props for the Babylon Editor… made coming to Babylon from Unity so easy!

As for my question/issue: I’ve created a Babylon project using the “Third Person” template in the Babylon editor (v4.4.0). This template provides a character that is a mesh with a skeleton as a child.
I’ve attached a mesh (item for player to hold) to one of the bones (within the editor), and that mesh is behaving as expected.

Since my intent is to make my game multiplayer, I’m trying to create a copy/clone of this player. However, each of my attempts to do so always leads to the following problem: the aforementioned mesh attached to one of the bones does not get copied/cloned along with everything else! Is this just a known property of copying skeletons?

These are the ways I have attempted to achieve this:

  1. Cloning the character in the Babylon Editor.

  2. Exporting the character as babylon object and reimporting into the scene

  3. Programmatically cloning the character within the scene:

var player2 = player1.clone("player2");
player2.skeleton = player2.skeleton.clone();

Doing it programmatically introduces another issue: the script attached to the player within the Editor does not seem to be attached. I’m guessing this is the case because the “onStart” function within the script is not getting called. I will make another post where I attempt to get more clarification on how scripts work in Babylon.

Please let me know what you guys think. I’m going to keep working on a PlayGround that showcases this, still trying to figure out importing the character.

cc @julien-moreau

Using AssetContainer is the simplest to dupplicate meshes with skeletons: GLTF mesh with skeleton, clone problem - #6 by bghgary

1 Like

Thank you for your answer @sebavan. I’ll give it a try and update this post!