Created
September 3, 2018 05:01
-
-
Save rockarts/a80b0831528864fa4f5c55aa16b3258a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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