Project setup and detecting a plane

The first thing that we have to do, before we even set up the project, is change some settings and detect a plane so that our game object will have a plane to start on. In the 3D game in Chapter 11, Introduction to SceneKit, we created the ground on which the player character was placed and can jump from. When we make an AR game, we first need to detect a physical real-world plane on which we want our game objects to be placed.

ARKit for SceneKit provides a specific function that does just that. In fact, there are three functions. The first one is didAddAnchor, then we have didUpdateAnchor, and finally we have didDeletAnchor:

 func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) ...

Get Swift Game Development - Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.