I'm facing an issue with my model that contains multiple meshes. I only want to apply a texture to one specific mesh, but when I do, the entire model ends up with the same texture. What could be the mistake I'm making?
function load_models(callback) {
var loader = new THREE.OBJLoader(manager);
loader.load(baseDir + 'files/' + model.model_name, function (object) {
object.traverse(function(child) {
if (child instanceof THREE.Mesh) {
var mesh = model.meshes.filter(function(mesh) {
return mesh.name == child.name;
}).shift();
if (mesh.is_fiberboard == true) {
child.material.map = mesh.material.texture;
child.material.needsUpdate = true;
child.geometry.buffersNeedUpdate = true;
child.geometry.uvsNeedUpdate = true;
}
}
});
callback();
});
}