I don't arrive to clone

Hey, I am new in babylonjs and I try to clone a character (glb) but I doen’t arrive. This is my code:
window.addEventListener(‘DOMContentLoaded’, function () {
var canvas = document.getElementById(‘container_img’);
var engine = new BABYLON.Engine(canvas, true);
engine.enableOfflineSupport = false; // Dont require a manifest file
BABYLON.OBJFileLoader.IMPORT_VERTEX_COLORS = true;
var createScene = function () {
var scene = new BABYLON.Scene(engine);
scene.clearColor = new BABYLON.Color3.White();
var camera = new BABYLON.ArcRotateCamera(“camera”, Math.PI / 2, Math.PI / 2.5, 2.9, new BABYLON.Vector3(0, 1, 0));

                camera.attachControl(canvas, true);
                camera.lowerBetaLimit = Math.PI / 2.5;
                camera.upperBetaLimit = Math.PI / 2.5;
                camera.lowerRadiusLimit = 2.9;
                camera.upperRadiusLimit = 2.9;

                var light = new BABYLON.HemisphericLight("HemiLight", new BABYLON.Vector3(0, 1, 0), scene);
                light.parent = camera;
                light.intensity = 3;


                BABYLON.SceneLoader.ImportMeshAsync("", "/", "untitled.glb").then((result) => {
                    var dude = result.meshes[0];
                    dude.scaling = new BABYLON.Vector3(0.25, 0.25, 0.25);
                    clone.skeleton = mesh.skeleton.clone();
                    scene.beginAnimation(result.skeletons[0], 0, 100, true, 1.0);
                    const dude2 = dude.clone("dude2");
                    dude2.position.x = -2;
                });







                return scene;
            }

thanks you :slight_smile:

Try to reproduce issue in the PG, this article may be helpful: Using External Assets In the Playground | Babylon.js Documentation

4 Likes

In addition to the missing playground - if the mesh is complex and has a skeleton, you will be better off using the assets container to duplicate your mesh: Asset Containers | Babylon.js Documentation

You load to the assets container, and then duplicate as many times as you want.

2 Likes

thanks!

1 Like