0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SceneKitのcubeNodeに色をつける

Posted at

はじめに

SceneKitでcubeNodeを次のように宣言している場合に、そのキューブに着色するためのコードをどう書いたらよいか。

InterfaceController.swift
var cubeNode = SCNNode(geometry: SCNBox(width: 5.0, height: 5.0, length: 5.0, chamferRadius: 0.0))

記述例

例えば、Swift3.0の資料に基づくと、青色に塗るためには、次のように記述できる。

InterfaceController.swift
let material = SCNMaterial()
material.diffuse.contents = UIColor.blue()
cubeNode.geometry?.firstMaterial = material
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?