Making a class in SceneKit is important. However, I cannot get it to work.
Here is my class code
import UIKit
import SceneKit
class Ship: SCNNode {
override init(){
super.init()
let box = SCNBox(width: 0.1, height: 0.1, length: 0.1, chamferRadius: 0)
let node = SCNNode(geometry: box)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
And here is my code in the ViewController (I am using ARKit)
let tempShip = Ship()
tempShip.position = SCNVector3(0.1,0.1,0.1)
sceneView.scene.rootNode.addChildNode(tempShip)
I think I am missing something basic.