Hi everyone,
I am trying to import a glb file with many objects (to be exact 58 objects and one mesh per object).
I am using the following command
BABYLON.SceneLoader.ImportMesh(‘’, ‘./assets/models/’, filename, scene, (objectMeshes) => {
objectMeshes.forEach((objectmesh) => {}
All meshes seem to load but some of the meshes appear in the wrong place (btw objects and transformations appear as expected in blender)
Is there a better way to import meshes? Thanks Michael
I tried using the BABYLON.SceneLoader.ImportMeshAsync which seems to work now (instead of Import Mesh)
but I get the following error when trying to use a registered action (was working before)
here is the code below
const result = await BABYLON.SceneLoader.ImportMeshAsync(‘’, ‘./assets/models/’, “export_scale_6_blender.glb”, scene);
result.meshes.forEach((objectmesh) => {
objectmesh.actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnRightPickTrigger, function () {
}))
})
Here is the error below
main.js:1524 Uncaught (in promise) TypeError: Cannot read properties of null (reading ‘registerAction’)
at main.js:1524:30
at Array.forEach ()
at createobjectAsync (main.js:1521:17)
As said above a PG would make it easier. But if I had to make I guess, it could be that you are trying to apply actions to objects that aren’t of class ‘mesh’ or ‘instance’. Try select by type mesh only and see what it does…