我想为我的对象创建一个材质,如下所示,我应该如何配置我的材质对象?这是我已经完成但没有工作的:
let colors = [UIColor.green,
UIColor.red,
UIColor.blue,
UIColor.yellow,
UIColor.purple,
UIColor.gray]
let materials = colors.map { color -> SCNMaterial in
let material = SCNMaterial()
material.diffuse.contents = color
return material
}
myObject.geometry.materials = materials