O'Reilly logo

Swift Game Development - Third Edition by Stephen Haney, Siddharth Shekar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required