当我试图在shapeNode中SceneKit: SceneKit错误:数组中添加颜色时,我得到了这个错误,用于材料属性内容的数组必须有6个元素
let shape = SCNSphere(radius: 1.0)
let sphereMaterial = SCNMaterial()
sphereMaterial.fresnelExponent = 1.0
sphereMaterial.shininess = 1.0
sphereMaterial.transparency = 1.0
sphereMaterial.diffuse.contents = [UIColor.green]
shape.materials = [sphereMaterial]当我将其更改为此时,会得到错误的SceneKit错误:无法从图像数组构建cubemap,因为索引0处的图像为NULL:
sphereMaterial.diffuse.contents = [UIColor.green,UIColor.green,UIColor.green,UIColor.green,UIColor.green,UIColor.green]我在Beta 9.6上运行这个,不确定这和它有什么关系。
发布于 2017-09-10 00:30:48
为材料属性分配颜色的正确语法为
sphereMaterial.diffuse.contents = UIColor.greenhttps://stackoverflow.com/questions/46136120
复制相似问题