Search code examples
angularbabylonjs

Importing a mesh only work with active Inspector


I have a strange problem in my angular app and I can't figure it out.
I am importing a mesh like this:

SceneLoader.ImportMesh("", "assets/models/", "model.gltf", this.scene, function(model) {});

But then I get this error:

Unable to load from assets/models/model.gltf: importMesh of unknown

Only when I start it with Inspector like this

Inspector.Show(this.scene, {});

the model is loaded correctly.

The model was exported from Blender in glTF Embedded format and it worked with Three.js also.


Solution

  • I got help in the babylonjs forum.

    add import "@babylonjs/loaders/glTF" to the import section and it will work.