Blog

Location-Aware AR on Unity Made Easy with IndoorAtlas

Augmented Reality (AR) Wayfinding is perhaps the most natural interface for navigating inside complex venues. For some users, AR content may also be just the twist that makes them stick to an app and use it again.

In a previous post we’ve described that while implementing indoor positioning is hard, accomplishing location-aware AR indoors is an even rarer species. This why you should consider leveraging IndoorAtlas, which provides indoor positioning coupled with AR and thus allows you to focus on the visualization and business logic. This hands-on post lets you get started with IndoorAtlas and Unity for building AR applications.

IndoorAtlas is a fully cross-platform indoor positioning and location-based AR solution. Using IndoorAtlas through Unity, you combine powerful things:

  • Cross platform development
  • The power of Unity in creating 3D user interfaces
  • IndoorAtlas’ unique location-based AR with AR Wayfinding and location-based AR ads or other AR objects

You’ll need the following:

Fast forwarding a bit, this is what you’ll have implemented at the end of this post:

 

Setup Your Development Environment

Now, start by getting the latest unity plugin by browsing to https://github.com/IndoorAtlas/unity-plugin and clicking the green check mark symbol on the latest commit:

 

Click the details of the second item that comes up in the dropdown:

 

Click the artifacts dropdown on the top right of the page and click the “indooratlas” link:

 

Download the file and extract it somewhere, you should end up with a file called indooratlas.unitypackage.

 

Choose the Mobile 3D template:

 

In a new project start by selecting Window -> Package Manager

 

In the package manager window make sure Unity Registry is selected:

 

After that install the following packages:

  • AR Foundation
  • ARCore XR Plugin (android support)
  • ARKit XR Plugin (ios support)

 

Next go to Edit -> Project Settings from the app menu, in the XR Plugin Management section make sure the Initialize XR on Startup and that the plugin providers for ARKit (iOS tab) and ARCore (android tab) are enabled:

 

On the Player Settings section make sure the following is done on the iOS tab:

  • Camera Usage Description is set
  • Target Minimum iOS version is 11.0
  • Requires ARKit support is set

 

For android tab the following must be done:

  • Graphics API must be OpenGLES3 (unity limitation right now)
  • The minimum api level must be set to 24

 

Next select Assets -> Import Package -> Custom Package… from the app menu:

 

Select the indooratlas.unitypackage:

 

On the next dialog make sure everything is selected and click import:

 

 

Building the Scene with IndoorAtlas

Now we can start building our scene. Start by adding XR -> AR Session and AR Session Origin objects to the scene:

 

Select the AR Session Origin object and make sure it has a AR Plane Manager component:

 

Next add a IndoorAtlas Session object to the scene:

 

Select the session object and configure it accordingly with your API key, secret and optionally with a custom endpoint if required:

 

Once done give the IndoorAtlas Session object a IndoorAtlas AR Wayfinding object:

 

Finally configure the AR Wayfinding object:

  • Plane Manager should point to AR Session Origin’s Plane Manager component
  • Camera should point to the AR Camera object
  • Compass is a object representing a compass arrow pointing to the walking direction
  • Goal is a object representing the destination
  • Turn is a object representing turn instruction arrows

 

To test the wayfinding immediately, you may check the Wayfinding option, and hardcode the Target to some known WGS + floor combination in your testing venue. The units in the AR world are in meters, thus objects can easily appear to be quite large. Make sure your 3D objects are small. For a fully working example you can refer to the example unity project included in the IndoorAtlas Unity Plugin git repository.

 

To conclude, here’s an example showing the POIs defined on your IndoorAtlas account. Selecting one makes it the AR Wayfinding destination:

 

We hope you have enjoyed this tech post! We’d be happy if you drop a note to us if you liked this one or if you have any questions.