Finishing touches
Although the game is done, we can see that the plane is completely covering the scene and breaking the AR experience. We will disable the rendering of the floor and make sure that only the shadow is preserved so that it looks like part of the real world.
To do this, after creating the floor, set the colorBufferWriteMask
value to 0 as follows:
let ground = SCNFloor()
ground.firstMaterial?.diffuse.contents = UIColor.gray
ground.firstMaterial?.colorBufferWriteMask = .init(rawValue: 0)
We don't need the debug information anymore, so we can comment out the debugOption
line in the viewDidLoad
function:
//sceneView.debugOptions = [ARSCNDebugOptions.showWorldOrigin, // ARSCNDebugOptions.showFeaturePoints, // SCNDebugOptions.showPhysicsShapes] sceneView.scene.physicsWorld.gravity = SCNVector3Make(0, -500/100.0, 0) sceneView.scene.physicsWorld.contactDelegate = self
Run the...