Load simple .obj returns no mesh

Hello,

After limits found on ThreeJs and Ammo, I try Babylon only since today.
After succed to display a ball with light, I try to load mesh.

Here is my code:

BABYLON.SceneLoader.ImportMesh( "box", "./models/", "box.obj", scene, function( newMeshes){
	if (newMeshes.length > 0) {
		newMeshes.forEach( mesh => {
			...
			});
		}
	});

Here is box.obj:

#	                Vertices: 8
#	                  Points: 0
#	                   Lines: 0
#	                   Faces: 6
#	               Materials: 1

o 1

# Vertex list

v -0.5 -0.5 0.5
v -0.5 -0.5 -0.5
v -0.5 0.5 -0.5
v -0.5 0.5 0.5
v 0.5 -0.5 0.5
v 0.5 -0.5 -0.5
v 0.5 0.5 -0.5
v 0.5 0.5 0.5

# Point/Line/Face list

usemtl Default
f 4 3 2 1
f 2 6 5 1
f 3 7 6 2
f 8 7 3 4
f 5 8 4 1
f 6 7 8 5

# End of file

No error, but “newMeshes.length == 0”

Some ideas ?

Best regards.

Is your mesh called “box” or just the file? You can try using empty string ( “” ) as first parameter to load regardless of mesh name. If it is still not working, try loading your mesh in sandbox.

i notice you dont have UV
i gusee you need use correct Last UV parameter as true
i dont remember the exact property but you can find it in document for load glb

have a look at the parameters:
SceneLoader | Babylon.js Documentation (babylonjs.com)

“box” I think should be an array and you need meshes with those names.

an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported

rootUrl - you are using a relative reference - have a look in your network tab that the file is being served.

Hello, Thanks all.

“filter” is the “word” of solution. I thought it was a name to GIVE to the main mesh.

1 Like