@bghgary What is the trick to bundling and deploying meshes with your app, then loading those meshes (say GLTF/GLB) across mobile platforms?
I see the Babylon React Native playground app code is loading externally referenced meshes but that’s not an option in our use case. We need to bundle all assets, including meshes, into the app.
I’ve only had success with .babylon files, renaming to .json and importing all using the import statement (rather than loading only the meshes required, when required). I’d rather use GLB if I can.
I’ve been able to use this technique to load bundled app textures but I haven’t had any success yet with GLB meshes. I keep getting the error below. I’m importing @babylonjs/loaders/glTF and have added glb to my metro config. Any ideas?
[RuntimeError: Unable to load from http://localhost:8081/assets/src/assets/meshes/bloc.glb?platform=android&hash=c1c8d179007750a2518dd2f0ea12744a: Error: Cannot create URL for blob!]
Sorry no as it’s an internal project, but I can confirm that I can build and run your SpacePiratesAR just fine.
In my project, local asset PNG textures and JSON files are loading fine as per your code and README. It’s just the GLB files I can’t seem to load. I’ve tried a basic textured cube and the Babylon ufo.glb asset.
I’m able to load all files, everything seems to work well, but this resolveAssetSource import is ‘red’ whatever I do but in the same time the app is working Thanks
Maybe it is related to the deviced used for testing, … or the model has the right dimensions and position?
For me worked without to touch ‘android’ files
Yeah after posting I realised it makes no sense, as @Cedric 's project builds and runs fine on the same device and that has no trouble with GLBs.
I also tried substituting Cedric’s GLBs into my project but they also don’t work in my project, so it’s something specific to my project structure or config.
Only other thought that comes to mind is maybe the order or timing of the import "@babylonjs/loaders/glTF"; is important? My project structure is quite deep and maybe the GLTF loader isn’t being found or used or something?
It’s a debug build. I checked the apk but there’s no glb, however there’s also none of the image or json assets (at least by those names) in there either that I can find, yet they are working.
Can you try restarting your typescript-server? There is no reason for it to fail, unless it is not officially exported from this path (i.e. - not exported in the type-file).