[REACT] Importing Lines from .babylon or .gtlf File?

Hi Community!

So, I got a model with 3D lines.

I’ve tried exporting it through Blender to .babylon and lines where lost.
Tested loading it on the sandbox and the lines were not there either, that’s OK.
Opened the file in notepad and notice the line obj did not exist either, that’s OK too.

So I changed to .gtlf, tried it on the sand box, worked fine.
Tried it on .html and was also able to load them.

So, the question is.
What do I need to do in React to load 3D Lines?

Do I need to install more than:

npm install --save-dev @babylonjs/core @babylonjs/loaders

import “@babylonjs/loaders/glTF”;

await SceneLoader.ImportMeshAsync(“LineName”, LinePath, LineFile, scene);

My REACT project is more like a shell, the code is all javascript… but still… what might I be missing?

Any tips?

Do you have that mesh in your “public” folder? That is deployed as “/“ unless you deploy to a base path (subdirectory). Check your network tab in devtools)

1 Like

Good one!
Thanks you very much.

I have my 3D models in src folder, I did this trick here:

Works fine for 3D models but no luck with 3D lines inside those same files.
So I’m assuming it must be something else.

So, it seems Lines were importing after all in .gltf format.

Due to the lines being very very big and offsetted I was having trouble finding them.
Their parent node not being a mesh made scene.getMeshByName = null.
Using scene.getNodeByName or getNodeById allowed me to finally find them.

Case closed.

1 Like