我有一个'attach node',它有两个Blender模型的子节点。我已经添加了第三个节点到这个SCNCone的附加节点。出于某种原因,我无法改变锥形节点的颜色,只有透明度。我似乎看不出代码有什么问题,但是在运行期间,无论我将其设置为何种颜色,锥体始终是黑色。无法更改SCNCone的颜色 - Scenekit
let coneGeo = SCNCone(topRadius: 0.1, bottomRadius: 0.7, height: 4)
let coneMaterial = SCNMaterial()
coneMaterial.diffuse.contents = UIColor(red: 255.0/255.0, green: 108.0/255.0, blue: 91.0/255.0, alpha: 0.2)
coneGeo.materials = [coneMaterial]
let coneNode = SCNNode(geometry: coneGeo)
coneNode.position = SCNVector3(0, -1.5, 0)
coneNode.name = "coneNode"
AttachNode.addChildNode(coneNode)
谢谢你检查你的阿尔法值!做'coneNode.geometry?.firstMaterial?.diffuse.contents = UIColor(红色:255.0/255.0,绿色:108.0/255.0,蓝色:91.0/255.0,alpha:0.2)'已经完成了。再次感谢。 – P3rry