Copy Mesh to another avatar


We have 2 avatars in T-pose would like to apply outfit of avatar 1 to avatar 2
With the below approach we were able to apply the mesh but some patches are visible once the mesh is copied.
Can somebody remove the patches once the cloning is done

avatar 1 is formal blazer
avatar 2 is casual dress

You have empty string as mesh name, but what is causing your error is that there is no mesh on your scene with this name:

const df=scene.getMeshByName("outfit_meta_1_lowpoly.png");

Thanks Takemura for the update…

I changed the mesh name still the same issue is persisting… can u suggest some workaround

Your playground has errors, because this lines has some faults:

const df=scene.getMeshByName("outfit_meta_5.png");
        const er= df.loadedMeshes[0];
        addNewDragon(er, 4);

First mistake is to use getMeshByName on Material. Then you try to access first “loadedMeshes”-array element of pseudo-AbstractMesh-Material, then you clone it.

Is this what you wanted to know, cloning suits?

Got yur point Takemura…

We need to clone avatar outfits to other avatar in T-pose.

In this case, we need to apply formal blazer outfit to casual person.

I am trying to read two meshes seperately using the below approach
mesh1 is rigged bare human body in T-pose
mesh2 is formal blazer in T-pose
const mergedModel = BABYLON.Mesh.MergeMeshes([mesh1,mesh2], true);

With this approach am getting formal blazer is in horizontal direction… can we adjust the position so that it will exactly the person without any gapes in the texture…

can somebody help me

There is no mesh named “mesh.001”, so your df = null. Also you cannot access another imported/loading mesh inside .onSuccess of another .glb-file.

It works by just cloning (+parenting) :

If you want to merge then I would suggest to set multi-material parameter of mergeMeshes to true. Furthermore the root and Armature-node are parents of your meshes, so their rotation has to be considered, to adjust mesh rotation in opposite direction. But I am not sure about animations, if they will still work, because merging meshes would change weight painting, so you would have to check it.