three.js material 设置颜色

这里需要new一个Color对象再赋值,直接设置颜色会报错

 let staffRegion = new THREE.BoxGeometry(...size); //长 高 宽
 let matarial = new THREE.MeshLambertMaterial({
            color: color,
            side: THREE.DoubleSide,
            transparent: true,
            opacity: 0,
 });
 let element= new THREE.Mesh(staffRegion, matarial); 
element.material.color = new THREE.Color(color);

你可能感兴趣的:(three.js material 设置颜色)