Find Spatial Anchors and localize content to the maps


The Navigation scene contains all the assets added to the map in the ARWAY Web Studio within the Developer Portal.
On the Project pane, go to Assets\ARWAYSDK\Azure Spatial SDK\Scenes
It contains the following major components -
  • MapsManager (Script)
  • AzureAssetImporter (Script)
  • AzureAnchorLocalizer (Script)
  • NavController (Script)
  • AStar (Script)
  • ARSpace (Gameobject)

Maps Manager Script:

The MapsManager.cs script is responsible for loading all the maps when the user starts the scene. After the user selects a map, he can then navigate through the selected map by choosing a destination.
Maps Manager (Script)

Azure Asset Importer Script:

The AzureAssetImporter.cs script imports all the assets into the scene once the page is loaded. The main components in the Navigation scene are:
  • Waypoints
  • Destinations
  • Images
  • Texts
  • 3D asset
  • Floor plan images
Azure Asset Importer (Script)

Azure Anchor Localizer Script:

The AzureAnchorLocalizer.cs script is responsible for finding the Azure anchors created during mapping and localizing the ARSpace to it.
Azure Anchor Localizer (Script)
In order to navigate from the user's current location to the selected destination, NavController.cs and AStar.cs scripts are being used.
You can change the navigation path UI by dragging a new prefab onto the navigation path prefab item.
Also, you can choose whether to show the path during runtime or not via the Show Path toggle.
Expand the Path item to see the shortest path to the selected destination from the user's current location i.e. the AR Camera.
For navigation to work, waypoints need to be added "from the origin to the destination at regular intervals" within the Floor Builder page in the Developer Portal.
NavController, AStar (Script)

What is ARSpace?

ARSpace is a gameobject present in the Unity scene hierarchy, that localizes any content placed under it as a child to the localized origin (0, 0, 0).
So, in order to display assets during runtime in the built application, the assets must be made a child of the ARSpace gameobject.

How to add content to ARSpace?

In order to add content to ARSpace, simply drag and drop the assets as a child gameobject to the ARSpace gameobject.
By default, there is a Gizmo gameobject as a child of ARSpace, which shows the localized origin in the scene during runtime.

How to Use?

Step 1: Open the Navigation scene found in the Assets/ARWAYSDK/Azure Spatial SDK/Scenes folder within the Unity project.
Step 2: In the Hierarchy window, look for ARWAYSDK gameobject and then click on it.
Step 3: In the Inspector panel, look for Arway SDK Script and enter your unique Developer Token in the Developer Token field and save the scene.
ARWAY SDK (Script)
Step 4: After saving, add the current scene to the build settings. Then choose the platform of your choice (Android/iOS/HoloLens) and build the application.
Step 5: Install the built app on your device and open it.
Step 6: Upon opening the app, you will see a list of Maps created on the ARWAY web studio. Choose the one corresponding to your location.
List of Maps created in Developer Portal
List of all the created maps in the ARWAY Web Studio. In order to learn how to create a map using the Web Studio, click on the link below.
Step 7: After choosing a Map, press the Localize button to find Azure Spatial Anchors in the area and localize content placed in the web studio with the PCD maps created while mapping.
Step 8: After successful localization, select the destination where you want to go from the Select Destination dropdown at the top.
Step 9: After choosing the destination, the shortest path will be shown to the user in the AR scene.
Navigation Demo