Hi I am trying to add a mini-game while using babylon through react application. So I have added a scene in a react component.
I get an error while trying to load a .glb file. I get the following error.
BJS - [15:06:48]: Unable to load from …/assets/sample.glb: importMesh of undefined from undefined version: undefined, exporter version: undefinedimportMesh has failed JSON parse.
PS: The 3D file is stored in a location in my local file system.
CODE BLOCK:
BABYLON.SceneLoader.ImportMesh(“”, “…/assets/”, “sample.glb”, scene, function (newMeshes) {
// Set the target of the camera to the first imported mesh
camera.target = newMeshes[0];
});
PS: The 3D file is stored in a location in my local file system.
Hi.
I’ve still been getting this warning inspite of importing the loaders. Could this be the reason for me not able to import gltf/glb assets.
BJS - [13:34:46]: Unable to find a plugin to load .159:8081/ipfs/xyz files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: https://doc.babylonjs.com/how_to/load_from_any_file_type
This is a warning. Followed by the following error.
BJS - [13:34:55]: Unable to load from http://3.7.57.159:8081/ipfs/xyy: importMesh of undefined from undefined version: undefined, exporter version: undefinedimportMesh has failed JSON parse
If the filename doesn’t have an extension you will need to provide it when loading/importing. It is the last variable of the import function. if it is a glb, the extension should simply be “.glb”
Hi sharath, Im new to babylonjs and getting exactly same error like yours, I have imported loaders but now getting error “Unable to load from …/models/Pillow.glb: RuntimeError: Unexpected magic: 1329865020”.
how did you resolve loading glb issue from local folder.
Thanks in advance
1329865020 translates to <!DO which probably is the beginning of an HTML page, which probably means that the server was unable to serve the request for some reason and served out an HTML page with some error code and message. The magic values for a GLB (i.e. the first four bytes of the file) is supposed to be the four characters glTF. Try accessing the URL directly and see if you can find out what the error is.