Created
April 22, 2018 22:48
-
-
Save PaulWall43/71a75083cfa55d01799ef889e59d60a8 to your computer and use it in GitHub Desktop.
This file contains 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
//After running the session we add a light node to help the scene look a little better | |
override func viewDidAppear(_ animated: Bool) { | |
super.viewDidAppear(animated) | |
//Create light object | |
let light = SCNLight() | |
//Set type to be ambient | |
light.type = .ambient | |
//Create corresponding node for light so we can add this into the scene graph | |
let ambientLightNode = SCNNode() | |
//Set position (won't change over course of session run). Note that position doens't matter for ambient light. | |
ambientLightNode.position = SCNVector3(0,5,0) | |
//Add our light object to the node | |
ambientLightNode.light = light | |
//Add node to scene graph and tada we have ambient light. | |
sceneView.scene.rootNode.addChildNode(ambientLightNode) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment