overridefuncviewDidLoad(){
super.viewDidLoad()// Set the view's delegate
sceneView.delegate =self// Show statistics such as fps and timing information
sceneView.showsStatistics =true//创建objectlet sphere =SCNSphere(radius:0.15)//上贴纸
sphere.firstMaterial?.diffuse.contents =UIImage(named:"art.scnassets/2k_earth_nightmap.jpg")//将物体添加到一个节点上let node =SCNNode(geometry: sphere)//设置位置
node.position =SCNVector3(x:0, y:0, z:-0.5)//添加节点
sceneView.scene.rootNode.addChildNode(node)}
静态创建
overridefuncviewDidLoad(){
super.viewDidLoad()// Set the view's delegate
sceneView.delegate =self// Show statistics such as fps and timing information
sceneView.showsStatistics =true
sceneView.debugOptions =.showFeaturePoints//显示检测平面的小点点// sceneView.autoenablesDefaultLighting = true //给3d模型打光// Create a new scenelet scene =SCNScene(named: