今回は、swift3で書いて、立方体に青色を付けてみる。
コード
override func viewDidLoad() {
super.viewDidLoad()
sceneView.delegate = self
sceneView.showsStatistics = true
let scene = SCNScene()
let cubeNode = SCNNode(geometry: SCNBox(width: 0.1, height: 0.1, length: 0.1, chamferRadius: 0.0))
let material = SCNMaterial()
material.diffuse.contents = UIColor.blue
cubeNode.geometry?.firstMaterial = material
cubeNode.position = SCNVector3Make(0, 0, -0.5);
scene.rootNode.addChildNode(cubeNode)
sceneView.scene = scene
}