-
Notifications
You must be signed in to change notification settings - Fork 0
/
Contents.swift
46 lines (29 loc) · 1.21 KB
/
Contents.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import SceneKit
import PlaygroundSupport
let sceneView = SCNView(frame: CGRect(x: 0, y: 0, width: 400, height: 400))
PlaygroundPage.current.liveView = sceneView
let scene = SCNScene()
sceneView.scene = scene
sceneView.backgroundColor = UIColor.gray
sceneView.autoenablesDefaultLighting = true
let node = SCNNode()
//torus.geometry = SCNTorus(ringRadius: 1, pipeRadius: 0.5)
//node.geometry = SCNBox(width: 1, height: 1, length: 1, chamferRadius: 0.1)
node.geometry = SCNPyramid(width: 1, height: 1, length: 1)
node.geometry?.firstMaterial?.diffuse.contents = UIColor.brown
//node.geometry?.firstMaterial?.specular.contents = UIColor.white
let node1 = SCNNode()
node1.geometry = SCNBox(width: 1, height: 1, length: 1, chamferRadius: 0.1)
node1.geometry?.firstMaterial?.diffuse.contents = UIColor.brown
//node1.geometry?.firstMaterial?.specular.contents = UIColor.white
node1.position = SCNVector3(0,-0.5,0)
node.addChildNode(node1)
//let floor = SCNNode()
//floor.geometry = SCNFloor()
//floor.position = SCNVector3(0, -1, 0)
//scene.rootNode.addChildNode(floor)
scene.rootNode.addChildNode(node)
SCNTransaction.begin()
SCNTransaction.animationDuration = 5
node.position = SCNVector3(0, 0, -1)
SCNTransaction.commit()