Hello,
I’m trying to load a GLB file with a different extension than .glb. I’ve tried a bunch of different things like loading it as binary and passing it to SceneLoader.ImportMesh, but for some reason that doesn’t work.
I would like to just use the simple approach shown here But I can’t figure out how to implement that in my JS file. And I can’t find any other mention of that feature.
I’m using ES6, the @babylonjs node modules, and webpack. So, how do I set those parameters?
Hi!
How do you load your model? The Load, ImportMesh etc’ functions have all a parameter called “pluginExtension” (Babylon.js/sceneLoader.ts at master · BabylonJS/Babylon.js · GitHub) , with which you can force the extension of the plugin to be used to load the file.
I am assuming the glb/gltf loader is already registered and is available (the simplest test would be to try and load a file with a glb extension and seeing whether or not it works).
Got it!
Stupid mistake, I wasn’t passing the necessary null
arguments to the method.
For future reference, this works for me and allows me to import any file as a GLB.
SceneLoader.Append("./", "yourfilename", scene, function (scene) {
// do something with the scene
}, null, null, ".glb");
The next step I wanted to do was load the GLB data from a larger blob of data. I was able to load the data with assetsManager.addTextFileTask
as well as assetsManager.addBinaryFileTask
. But I can’t figure out how to get SceneLoader to take that stringified data. I tried prepending “data:” as stated here but it wasn’t working for me.
1 Like