Skip to content

Instantly share code, notes, and snippets.

@rockarts
Created September 3, 2018 05:01
Show Gist options
  • Select an option

  • Save rockarts/a80b0831528864fa4f5c55aa16b3258a to your computer and use it in GitHub Desktop.

Select an option

Save rockarts/a80b0831528864fa4f5c55aa16b3258a to your computer and use it in GitHub Desktop.
import UIKit
import Mapbox
import SceneKit
import MapKit
import MapboxSceneKit
class ViewController: UIViewController {
var sceneView: SCNView = SCNView()
var scene: SCNScene = SCNScene()
let cameraNode = SCNNode()
override func viewDidLoad() {
super.viewDidLoad()
setupSceneView()
}
func setupSceneView(){
self.view.addSubview(sceneView)
sceneView.frame = self.view.bounds
sceneView.scene = scene
sceneView.allowsCameraControl = true
sceneView.isPlaying = true
cameraNode.camera = SCNCamera()
cameraNode.position = SCNVector3(x: 0, y: 0, z: 3)
scene.rootNode.addChildNode(cameraNode)
let lightNode = SCNNode()
let light = SCNLight()
light.type = .ambient
light.intensity = 1000
lightNode.light = light
scene.rootNode.addChildNode(lightNode)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment