Hi,
I need to import mesh synchronoulsy to do something with the mesh after.
I already try ImportMesh without expected effect.
To example i have this following code
main.js :
let obj = new Obj_Asset(objName, filePath, fileNameWithExtension);
obj.loadObj(babylonPositionXYZ);
// do something with obj.mesh, for example the folowing console.log
console.log(obj.mesh); // currently return undefined
Obj_Asset :
class Obj_Asset {
constructor (objName, filePath, fileNameWithExtension) {
this.mesh = undefined
this.objName = objName
this.filePath = filePath
this.fileNameWithExtension = fileNameWithExtension
}
loadObj(positionXYZ) {
BABYLON.SceneLoader.ShowLoadingScreen = false;
let importedMeshes = BABYLON.SceneLoader.ImportMesh(null, this.filePath, this.fileNameWithExtension, scene);
this.mesh = BABYLON.Mesh.MergeMeshes(importedMeshes.meshes, true, true, undefined, false, true);
}
}
I don’t want to put make loadObj async and put an await on ImportMesh, it force me to put an await on obj.loadObj on main an a asyn on his parent function, so it force me to put an await to… bla… bla… bla…
did someone have an idea ?
thanks by advance