I added one object by AssetsManager in mesh. I again added second object by OBJ file by this way
replaceMesh(path, file)
{
BABYLON.SceneLoader.ImportMesh("", path, file, scene, function (myMeshtwo) {});
}
second object I added by button onclick.
Now i want to replace second object. To replace it, I did this
replaceMesh(path, file)
{
myMeshTwo.dispose();
BABYLON.SceneLoader.ImportMesh("", path, file, scene, function (myMeshtwo) {});
}
so i am trying to dispose second object and added new object, but it’s not working.
I also try
for (mesh of myMeshtwo)
mesh.dispose();
error: myMeshtow is undefined
I also try to get mesh by id and dispose but not get luch.
var mymesh = scene.getMeshById(“myMeshtwo”);
If I try to add mesh id by putting name
BABYLON.SceneLoader.ImportMesh(“meshname”, path, file, scene, function (myMeshtwo) {});
It’s not load new object.