Using the Indoor Navigation Sample

This sample scene features a basic navigation app using the Immersal AR Cloud SDK and Unity's NavMeshComponents System.

Before You Get Started

You need a navigation mesh that is based on the sparse point cloud or dense mesh files that you can download from the Developer Portal.

This mesh needs to be built in a 3D software such as Blender, Maya or 3ds Max or in the Unity Editor with ProBuilder.

This help page covers the workflow using Blender.

Building the Mesh

Log in to the Developer Portal and download one of the .ply files. I chose to download the sparse point cloud.

The point cloud is generated for a right-hand Y-up coordinate system. You may have to rotate it depending on your software of choice.

Import the .ply file into Blender. You'll notice that the point cloud is oriented sideways. Blender uses a right-handed system, but Z-up instead of Y-up.

In other software with matching coordinate systems, such as Maya, Houdini or Modo, the point cloud would be oriented correctly.

Z-up coordinate system in Blender

In Blender, we need to rotate the point cloud 90 degrees on the X-axis to correct the point cloud orientation.

The point cloud with its Y-axis now pointing up

Now we can use the point cloud as a reference for building our scene. For navigation, we only need to create a mesh for areas where the user can move. In this case, the floor.

Use the basic modelling tools to build the geometry and align it to the point cloud. Make sure the floor level matches the floor level in the point cloud.

Simple floor geometry
Floor level matches the point cloud

Exporting Your Mesh

Export the geometry you created as a .fbx file. The Default settings work just fine, but be sure to check "Selected Objects" to only export the floor geometry.

Export the floor geometry
Export settings in Blender

It is good practice to clean the mesh before exporting.

Make sure that the object pivot is at scene origin so it matches the point cloud. Apply all rotations so the default orientation matches the point cloud. Make sure scale is applied. The object should have a scale of 1 in all axes.

Setting Up Navigation In unity

This sample uses Unity's NavMeshComponents System. It's included in our GitHub repository so you do not need to download it separately.

Open the NavigationSample scene in Assets/ImmersalSDK/Samples/Scenes.

Import your floor geometry into Unity and drag it into the scene under the AR Space Game Object. Set up your AR Map with the map data file of the location.

The point cloud preview and floor geometry should align.

Scene setup with floor geometry, navigation targets and point cloud preview.

Put the floor geometry onto the Navigation layer in the inspector. The NavMesh generation is set up to consider all geometry in the Navigation layer for baking the final Unity navigation mesh.

navigation_mesh in Navigation layer.

Select the Generate Navigation Mesh Here Game Object and click Bake in the inspector. You should see the NavMesh Data overlayed in the viewport.

The walkable area should cover all of the floor and should align with it.

Navigation is all set up, now we only need targets.

Setting Up Navigation Targets

A navigation target in this sample is simply a Game Object with IsNavigationTarget.cs script applied to it.

The script has options for setting up the targets Category, Name and Icon that will appear in the Target List Menu later.

There are three predefined targets in the scene.

  • navigation_target_a

  • navigation_target_b

  • navigation_target_outside_of_navmesh

To test the app, you should place the first two targets on top of floor geometry and the last outside the Geometry.

The system will try to find targets that are reachable using the walkable area, so targets outside the area or targets too high to reach are not found.

The default height threshold is 2 meters. This can be changed via Window -> AI -> Navigation -> Agents.

Testing the App

Open the Build Settings and only add or select the NavigationSample to be included. Build the app for your device.

When you look at the location you had mapped with the app running, the device should be able to localize and find its pose in seconds.

After successfully localizing, the floor geometry should align to the real world. Press Show Navigation Targets and pick a target to test navigation.