Cloning GLB Meshes results in error

I have a GLB file which has the following node hierarchy:
root
|------mesh1
|------mesh2
|------mesh3

Now I’d like to create a clone

BABYLON.SceneLoader.ImportMesh("", "https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/Avocado/glTF-Binary/", "Avocado.glb", scene, function (importedMeshes) {
        const root = importedMeshes[0];
        let clone = root.clone("cloned");
        clone.position = BABYLON.Vector3(-1,0,0);
    });

But I get an error

See playground https://playground.babylonjs.com/#0JXS5F#1

What is the correct way of cloning the entire GLB asset?

You were missing the “new” keyword in the Vector3 creation line 23, so it was not creating the correct object :slight_smile: Cloning GLTF Files | Babylon.js Playground (babylonjs.com)

2 Likes

Aww…snap. Thanks for the keen eye @carolhmj

1 Like