I'm encountering an issue with CSG on imported meshes. Here's the code snippet in question:
let x; let y;
BABYLON.SceneLoader.ImportMesh("", "./public/Models/", "model1.stl", scene, function (newMeshes) {
// Set the camera target to the first imported mesh
camera.target = newMeshes[0];
x = newMeshes[0];
});
BABYLON.SceneLoader.ImportMesh("", "./public/Models/", "model2.stl", scene, function (newMeshes) {
// Set the camera target to the first imported mesh
//camera.target = newMeshes[0];
y = newMeshes[0];
});
const xCSG = BABYLON.CSG.FromMesh(x);
const yCSG = BABYLON.CSG.FromMesh(y);
"x" and "y" are showing as undefined, with Debug pointing out that
"BABYLON.CSG: Wrong Mesh type, must be BABYLON.Mesh"
Is there a way to convert an imported mesh to BABYLON.MESH?
Thank you for your help!