我正在SceneKit中制作游戏,我需要为用作盒子材质的图像添加色彩。如何为材料/图像添加蓝色?
这是我的代码
let material = SCNMaterial()
let whiteSquare = UIImage(named: "whiteSquare.png")
let boxNode = SCNNode(geometry: SCNBox(width: 0.5, height: 0.2, length: 0.5, chamferRadius: 0))
material.diffuse.contents = whiteSquare
boxNode.position.z = -1.25
boxNode.position.y = 0.1
boxNode.name = "Block\(height)"
boxNode.geometry?.materials = [material]
scnScene.rootNode.addChildNode(boxNode)