传入想要改变颜色的3D模型对象,选择子级mesh的名字修改模型局部颜色
object.traverse(child=>{
// if(object.name==='model.glb') {
// console.log("加工中心",child.name)
// // flashingName = "mesh_8"
// }
if(child instanceof THREE.Mesh && child.name===flashingName){//给指示灯上色
// let newMaterial = child.material.clone();
newMaterial = new THREE.MeshBasicMaterial({
color: showColor, //可修改报警时的闪烁颜色
transparent: true,
opacity: 0.8, //可修改报警闪烁是的透明度
wireframe: false,
// depthWrite: false,
side: THREE.DoubleSide,
});
child.material = newMaterial;
}
})