Hey, everyone, I’m running into this problem when loading babylon and gltf files from any server that isn’t local host.
So basically you’ll load the scene, but the ground doesn’t load the first time no matter what and you’ll fall into nothing. Even disabling physics and waiting will not cause the ground.glb to load. It’s only after pressing F5 and refreshing the page that I assume the cookies will kick in and load the rest of the glb file.
Because it loads on the second refresh, I assumed it was simply that the file size is too big to load in one run, but taking away all of the textures and everything, making it smaller than the player character file size, doesn’t seem to have any effect. I then assumed it was because it was a GLB instead of a babylon file, but the babylon file behaves exactly the same way.
I was originally using the import mesh command, and then I switched to the asset manager in hopes that would fix it, but it does the same thing. For some reason it gives up on loading the file half-way through, and it’s only after refreshing that it loads the rest of the files utilizing what it had loaded previously from the cookies I believe. Pressing ctrl + F5 to refresh without cookies will cause the ground not to load as before.
The code is pretty basic. The on success is somewhat complex, but I’ve tried removing that and it acts the same.
It’s not even that it loads the ground too slow, like I said, if I disable gravity the floor never loads. It simply gives up on the file until the next refresh.
Is there some kind of force model load I can use to make sure it loads the entire file before moving on?
This looks suspicious to me. I do not see any relation between our code and any cookie. Can you explain why you think it is cookie related?
Can you repro on the playground as well so we can easily see the code?
1 Like
Oh well the reason I believe it is cookie related is because it’s only on the primary load that the ground does not appear. When refreshing the second and subsequent times, the model does load. Also pressing ctrl+f5, the shortcut for refreshing while clearing the cookies, causes the problem to occur again.
I will try my code on the playground and repost it here when I am off work though! Thanks for your time as always, Deltakosh!
Edit: Hmm I’m having some weird connection problems with the playground for some reason. I can’t imagine what’s causing it exactly, but I’ll see if I can get it fixed to upload another test. It’s odd, I live with my twin brother and he can connect to it just fine. I’ll get back to you on that.
Sorry for the playground. It is fixed now
1 Like
Alright, so I made a playground and it loads fine, but whenever I try to do any kind of “onSuccess” function, it doesn’t seem to work and the console says that the model couldn’t be loaded, when it clearly has been.
https://playground.babylonjs.com/#PN1NNI#142
If I comment out the visibility line, no error message is produced at all, so it’s definitely that one line that’s causing it to output the “model not found” error to the console. I doubt it’s related to the main problem anyway though.
Ah, I got it! I didn’t fix the playground problem, but I did manage to fix the problem I was having!
As it turns out, it was a combination of 2 problems. In addition to the gravity being turned on too soon while loading, I also had included an extra GLTF loader, one in my babylon.custom.js and the gltf_validator/babylonjs.loaders.js that I downloaded from the playground and forgot to remove from my script sources. It must have been causing some sort of conflict that only made the model load on the second try.
Thanks again for your help, Deltakosh, I appreciate it!
1 Like
Self fixed problems
My favorites !!
1 Like