i'm having trouble importing an obj file using OBJLoader
The obj file looks like this -
Obj Image
https://i.sstatic.net/HPdR8.png
But when imported into Three.js, it looks like this -
Obj in Three.js
https://i.sstatic.net/CoSYz.png
The obj file is not importing correctly. What can I do to fix this issue?
The code I am currently using is
var objLoader = new THREE.OBJLoader();
var mtlLoader = new THREE.MTLLoader();
mtlLoader.setTexturePath("obj2/");
mtlLoader.setPath( "obj2/" );
mtlLoader.load( "Mules/Base_10.mtl", function( materials ) {
materials.preload();
objLoader.setMaterials( materials );
objLoader.load( 'obj2/Mules/Base_10.obj', function ( object ) {
object.traverse( function ( child )
{
if ( child instanceof THREE.Mesh )
{
meshes.push(child);
}
});
var object = meshes[meshes.length-1];
object.position.y = -0.05;
object.position.x = 0;
object.position.z = 0;
object.name = "salto";
scene.add(object);
}, onProgress, onError );
});
Any help or suggestions would be greatly appreciated. Thank you!