Dec 27 • Ashray Pai

Immersal Indoor Navigation | Immersal SDK

In this blog, we’ll see how to create an AR pathfinding/navigation app. All you need is a spatial map of your environment (creating one is super easy), and knowledge on how to use Unity Game Engine. We’ll be using Immersal’s SDK to build this application. So, let’s get started!
YouTube

Want to watch the video instead?


1. Create a Spatial Map

  • Register as a developer here on Immersal’s website.
  • Download the Universal Mapper App (available on Android/iPhone) and log in using your credentials.
  • Launch the immersal mapper app and click Create New Map.

You can map your environment in two ways:

  • Real-Time Mode: Quick and automatic but lower quality.
  • Manual Mode: Higher quality but requires careful image capture. Sice AR Pathfinding requires a good quality map it’s recommended the use Manual Mode for mapping.

💡 Pro Tip: Take your time mapping. Good maps = better AR experiences! Follow the mapping guidelines.


2. Set Up Unity

  • Unity Project:
    • Make sure you are using Unity Editor verison 2022.3 LTS or above.
    • Create a new Unity Project, you can select either 3D core or URP as the starting template.
  • Install the Immersal SDK:
  • Scene Setup:
    • Create an empty scene.
    • Add AR Session and XR Origin, from the XR menu
    • In the project window, search for Immersal SDK and add the prefab to the scene.
    • Create an empty gameobject and name it XR Space.
      • Add XR Space Component to it.
      • Create two child object and name them Pose Filter and Pose Smoother, and add the same components to them.
      • Make sure to reference theses components inside the XR Space Component
    • Create an empty gameobject, name it XR Map and the XRMap component to it .

  • Download Your Maps:
    • Log in to the SDK  -> go to the developer portal and copy your map ID.
    • Paste it into Unity’s XR Map component -> check the box for Metadata , Mapfile and Visualization. Then click Download.
    • Duplicate thee XR Map -> go to developers portal and copy the next Map ID.
    • Then back in Unity, click on 'Reconfigure Map'  and paste the ID and make sure to check the box for Metadata , Mapfile and Visualization and click on Download.

3. Align Your Maps

  • Download the GLB files of your maps from the portal.
  • To import glb files into Unity, navigate inside Package Manager -> select add package by name and enter: com.unity.cloud.gltfast.
  • Then import the glb filers into Unity and align the maps inside the XR Space object.
  • Use precise transforms to ensure the maps match your environment perfectly.

4. Creating Navigation

  • Generate a NavMesh:
    • Create 3D planes for your room floors.
    • Create and assign them to a new layer called "Navigation."
    • Create a new gameobject and name it GenerateNavMeah -> add the NavMeshSurface component -> set the Include Layers parameter to Navigation -> Bake the mesh.
  • We can now delete the room models and hide the planes by disabling the mesh renderer.
  • Add Navigation Targets:
    • In the project window, search for Navigation -> Drag the Navigation UI and Navigation Target prefabs into your scene.
      Make sure to add the targets as a child of XR Space.
    • Place Navigation Targets at desired locations (e.g., one in each room).

5. Add Realism with Occlusion

  • Create walls using 3D objects like cubes.
  • Create a new material and set the shader as Occlusion -> apply the Occlusion Material to these walls.

6. Build and Test

  • Save your scene and go to File > Build Settings.
  • Connect your phone and click Build and Run.
  • Once localized, select a target to see the path in AR!

And that’s it! In just a few steps, we’ve built an AR pathfinding app without writing a single line of code.

In the next blog, we’ll dive into overlaying BIM models to visualize hidden pipes and ducts in real-world environments. 

Thanks for reading this blog post 🧡

If you've enjoyed the insights shared here, why not spread the word? Share the post with your friends and colleagues who might also find it valuable.
Your support means the world to us and helps us create more content you'll love.