I have a model with a lot of meshes. I want to apply texture only to a single mesh. But the problem is that the whole model changes it's texture. What am I'm doing wrong ?
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();
});
}
这是Three.js 76中的一个问题。在更新为Three.js 79之后它已经消失了。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.