I am facing difficultly in disabling a 3D model mesh completely from an external function in the same script. How do I refer the var mesh in my external function? For example, in the below example how do I give global reference to vpMesh?
var model;
class Playground
{
static CreateScene(engine, canvas)
{
....
....
model = BABYLON.SceneLoader.ImportMesh(null, "Models/", "scene.gltf", scene, function (vpMesh)
{
console.log("ModelLoaded");
vpMesh.forEach((m) =>
{
m.renderingGroupId = 2;
});
});
}
}
<script>
function DisableModel()
{
//Disable Mesh here
}
</script>