Adding Game Objects
Create a new setupGame
function. We start adding game objects to the scene. To do this, add the following to the setupGame
function.
Stop detecting planes
The first thing we do in the setupGame
function is disable the checking of planes in the scene. Add the following code to change the configuration and run the new configuration:
configuration.planeDetection = ARWorldTrackingConfiguration.PlaneDetection(rawValue: 0) sceneView.session.run(configuration)
Adding light source
Then we add a light source to the scene:
let directionLight = SCNLight() directionLight.type = SCNLight.LightType.directional directionLight.castsShadow = true directionLight.shadowRadius = 200 directionLight.shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.3) directionLight.shadowMode = .deferred let directionLightNode = SCNNode() directionLightNode.light = directionLight directionLightNode...