Babylonjs-loaders 4.0.3 SceneLoader Append issue

Trying to append an OBJ file to the scene but it is not loading. There are no errors in the console but when logging the scene I am not seeing the mesh being fetched.

 // This code block is not working as it should

BABYLON.SceneLoader.Append("mesh/", "HEAD.obj", scene, () => {
   scene.createDefaultCameraOrLight(true, true, true);
   scene.createDefaultEnvironment();
 });

The files are setup up as such

mesh/HEAD.obj scenes/Scene.js (This is where I am trying to load the mesh)

This wouldn’t matter because as mesh/ it would search localhost:3000/mesh/HEAD.obj which is it’s proper location.

Additionally, I have installed and imported babylonjs-loaders in the component as well but this is still not working. Again, no errors in the logs :frowning:

Hello and welcome :wink:

Does the file work in the sandbox?

I have not tried that. I have a buddy who is using version "babylonjs-loaders": "^3.2.0-alpha0" of babylonjs-loaders and our SceneLoader.Append is setup exactly the same, with the files we’re looking to import in the exact same place in our independent directories. His Append works fine. Mine does not.

Unfortunately without a repro I can’t help :frowning:

Should I upload the .obj file or the code itself?

Well if you can repro on the playground with your obj it would be fantastic
Here is the doc to read external assets on the PG: Using External Assets - Babylon.js Documentation

The answer to my question was found here! Trouble loading assets in React - Questions & Answers - HTML5 Game Devs Forum

Using create-react-app to build my project made things a bit more complicated.

2 Likes