ARKit Planes, 3D Text and Hit Detection

Dan Wyszynski
S23NYC: Engineering
10 min readJun 22, 2018

--

In Part 2 of the series, we built up on our AR scene by providing some interactivity, and getting more familiar with SceneKit. We also looked at the rendering camera, and used it’s position (i.e. the user’s position in the real world) to drive an animation in our sphere object.

In this post we’re going to begin detecting horizontal planes, and attach objects to these planes.

The code for this tutorial can be found at: https://github.com/AbovegroundDan/ARTutorial_Part3

Detecting Planes

Detecting the plane

ARKit provides full lifecycle callbacks for when a plane is detected, when a plane is updated, and when a plane is removed, by way of the didAdd/didUpdate/didRemove node callbacks:

By checking whether the anchor passed in is of type ARPlaneAnchor, we can tell whether the anchor that was detected is a surface or not.

The plane anchor will also have information on whether the detected plane is oriented horizontally or vertically, depending on the options you passed in when configuring the planeDetection property in the ARWorldTrackingConfiguration when creating the session.

--

--

Dan Wyszynski
S23NYC: Engineering

iOS, Android & AR @ Nike, developer of Triller, Effects Wizard, Creepy Crawly Kingdom, DaVinci's Secret Machines, DrawPals, Punch! Culture Shelf & more.