GrosSacASacs Posted March 26, 2016 Share Posted March 26, 2016 How can I use the same mesh for 2 different object in the 3D space ? What I tried: //... //before the mesh is loaded we use another mesh hero = BABYLON.Mesh.CreateSphere("sphere1", 16, 0.1, scene); enemy = BABYLON.Mesh.CreateSphere("sphere2", 16, 0.1, scene); BABYLON.SceneLoader.ImportMesh("fr", "/", "models/5.babylon", scene, function (newMeshes, particleSystems) { camera.target = newMeshes[0]; hero = newMeshes[0]; enemy = newMeshes[0] //how can I separate hero and enemy again ? } ); //... If there are different ways to do , give me the one that uses the least resources. Quote Link to comment Share on other sites More sharing options...
adam Posted March 26, 2016 Share Posted March 26, 2016 You can use instances: http://doc.babylonjs.com/tutorials/How_to_use_Instances http://doc.babylonjs.com/classes/2.3/Mesh#createinstance-name-rarr-instancedmesh-classes-2-3-instancedmesh- or clones: http://doc.babylonjs.com/classes/2.3/Mesh#clone-name-newparent-donotclonechildren-rarr-mesh-classes-2-3-mesh- Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.