cant find how to add mtl file to obj(need to replace child.material.color with MTL file )
this is my code,plz help
var loadOBJ = function(){
var manager = new THREE.LoadingManager();
var loader = new THREE.OBJLoader( manager );
loader.load( 'box.obj', addBoxInScene);
};
var addBoxInScene = function(object){
Box = object;
Box.position.x = -3;
Box.position.y = -1;
Box.position.z = 490;
//Go through all children of the loaded object and search for a Mesh
object.traverse( function ( child ) {
//This allow us to check if the children is an instance of the Mesh constructor
if(child instanceof THREE.Mesh){
child.material.color = new THREE.Color(0Xf25922);
//Sometimes there are some vertex normals missing in the .obj files, ThreeJs will compute them
child.geometry.computeVertexNormals();
}
});
//Add the 3D object in the scene
scene.add(Box);
render();
};