Getting Started with RealityKit: ARCoaching

Part 3: Natively helping your users anchor themselves with an ARCoachingOverlayView

Max Fraser Cobb
Aug 5, 2019 · 4 min read

One of my favourite things to come out of this year’s ARKit updates has got to be the new ARCoachingOverlayView; it is a way to help. If leveraged correctly it can also be the ideal tool for developers to know when the best time is to add your objects to the scene. A main reason it’s one of my favorites is that it is incredibly easy to set up.

This view can be used in any ARSession, so it does not care whether you’re using RealityKit, SceneKit or Metal. The steps for achieving this, after adding your ARCoachingOverlayView to the app window, are:

  • Set the coaching view’s goal. See the Goal options by clicking here. The options include: horizontalPlane, for anything like a table-top or the floor; verticalPlane, this could be a wall or a big painting, ideally a wall with a bit of contrast; anyPlane, which is of course will complete on any of the previous two; and finally tracking, which is when ARKit is comfortable that it has enough feature points to be able to position things well. notably no face or object tracking states there (yet)
  • Set the coaching view’s session to your ARSession. This is how it will know when your goal has been achieved.
  • Optionally you can also set the delegate. This is ideal if, for example, you only want to add objects to the scene once you know that the AR tracking is stable using callbacks found in the ARCoachingOverlayViewDelegate protocol.

Doing just those things outlined above, with the goal being set to .horizontal, you’ll be able to get an overlay view that looks like the one below.

A video of the ARCoachingOverlayView animation searching for a horizontal surface
A video of the ARCoachingOverlayView animation searching for a horizontal surface
ARCoachingOverlayView animations on a black background

Let’s see what this looks like in code:

extension ARView: ARCoachingOverlayViewDelegate {

That’s the delegate, session and goal all set; the order of these 3 does not matter FYI. I’ve also made use of the delegate to show how you might call an action once the ARCoachingOverlayView completes, with the use of the coachingOverlayViewDidDeactivate method. Bear in mind that if your user loses tracking the overlay may popup again; if you want to avoid this from then adding your objects to the scene twice then either turn off the automatic triggering for the overlay with the activatesAutomatically property, or do a simple check with a bool or otherwise to check if the coaching has completed previously.

An video of the app scanning the floor to detect a horizontal surface
An video of the app scanning the floor to detect a horizontal surface
ARCoachingOverlayView detecting a horizontal plane and adding objects to the scene (speed 1.5x)

To see this running yourself, you could clone the GitHub repository; which I aim to have supporting all RealityKit features over the next few months. The file where the ARCoachingOverlayView examples are in can be found here:

That’s all there is to getting started with a ARCoaching, I hope this article has helped to show how useful and elegant this View is, and we start to see it in many apps after iOS 13 is released.


As usual, if you found this helpful please give this post some 👏👏👏, leave a response if you think there’s something important I’ve missed out, and keep an eye out for the next article in the coming weeks!

Click the link below for the main article in this series, which links to all the sections.

Max Fraser Cobb

Written by

Augmented Reality Engineer and mathematician. Excited for the future of AR and what amazing people are going to create.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade