Iâve tried updating the code and im not seeing it work:
My data is stringified serialised data, not a glb - which was used in the previous playground example to add a mesh to the scene, which is then serialised using SceneSerializer
LoadFile loads the dataurl into a data uint8array.
Then, from the doc, the uint8array is converted to a blob and an object URL
then, the url is loaded as a glb
a .glb is a binary file, i donât think itâs safe to be managed as a string.
Thanks for the response.
I think there is some confusion here.
The babylon scene i serialize contains some meshes, i serialize the entire scene along with the mesh using SceneSerializer, i then stringify this and store it somewhere. I reload the ENTIRE scene along with the meshes back into BabylonJS.
I was not asking how to load a .GLB or best practices. Look at the subject of this post.
This is now really confusing me because it works in the playground but not working on my local repo project which uses es6 npm build of babylon @babylonjs/core etc etc, not sure if thats broken it or what the difference could be.
I get this error:
app-index.js:31 BJS - [10:14:58]: Unable to load from data:{"autoClear":false,"clearColor":[0.2,0.2,0.3,1],"ambientColor":[0,0,0],"gravity":[0,-9.807,0],"collisionsEnabled":true,"useRightHandedSystem":false,"morphTargetManagers":[],"lights":[],"cameras":```
SceneLoader.Append("", `data:${testData}`, this.scene, (scene) => {
// do something with the scene
});
this class is found in material.decalMapConfiguration, so you will need to import this one as well.
if this doesnât work - try importing one of your classes directly from babylonjs/core (without any other directory). If this works - it is a missing side effect. In this case I will be happy to get a reproduction (zip file or a github project?) if possible, to be able to see what happened
I have added the code to load the scene data, and getting the same aforementioned error. It seems to be related to the nextjs setup somehow. I tested it on a blank webpack project and it worked there, but does not work with a nextjs project.