HEEEELP! Need help importing a .babylon mesh

Hi there community! Very new to programming (like one week of experience) so I apologize in advanced for my bad coding practices. I have troubles trying to import a .babylon mesh into my scene. I’m using:

BABYLON.SceneLoader.ImportMesh("", “./”, “dummy3.babylon”, scene, function (meshes) {});

I’ve tried playing around with the ./ by using /home/folder/…, keeping it blank and still nothing (mesh file is also right next to the script file). Tested with playground and it works. Do I have to add something to run the code?

Hi @phillip_lee,

Welcome to the forum

I wonder - does the file load correctly? want to host it somewhere and create a playground for us on https://playground.babylonjs.com so we can help better?

https://www.babylonjs-playground.com/#C38BUD#13
Took a while to figure out the url thing. Sorry!

You will need to host the .babylon file, otherwise you will only get a 404 when trying to load it. If you are looking for an example for mesh import:

https://playground.babylonjs.com/#UKNERM#0

Oh cool. How would I be able to do that? Run a node.js server?

As long as it is reachable online (has a domain, or ip). for example, you can host a file on github.

Byt this might be the issue with your .babylon file when loading it locally - you need a server (even a local server) to host the file, otherwise the browser will not find the file.

1 Like