# Boundary System

# Table of Contents

# Introduction

The boundary system is used to help users setup a custom boundary virtually, that matches their physical environment, so they can play safely within in it. When an user nears the boundary or steps out of the boundary, the system should notify the user by turning on visual see through mode (VST mode) or by showing a boundary rendering.

The boundary system has two parts. One part is an Android activity to help users draw a custom boundary and the other one is an Android service running in the background to detect player proximity to the boundary and rendering the boundary when a player nears it. The last part also provides an AIDL interfaces for third party services to interact with the boundary system. Both the boundary creation activity and the rendering service exist in the same application.

Boundary system introduction

# Prerequisites

  1. Install the Spaces Services and make sure the device can run at least the Spaces Samples (either the Unity or the Unreal Engine one). Additionally, make sure that the Display over other apps permission has been given to the Spaces Services.
  2. Unarchive the BoundarySystem.zip archive. This archive includes the .bat scripts needed in the following chapters and the boundary application.
  3. Install the boundary application and make sure it has the File and media permission given in the system settings.
  4. The boundary system needs at least the left controller to setup the boundary. If there is no controller available when the boundary system starts, it may crash.

# Boundary setup

To start the setup process of the custom boundary, start the "BoundaryApp" from the Android Launcher. Make sure that the boundary service was stopped before setting up a new boundary, or it will crash.

Follow the guidance within the application to finish the setup of a new boundary.

Setting up the boundary


Make sure to scan the environment for a decent amount of time to let the system collect enough point cloud information. Otherwise, there might be an issue with locating the scanned location later on. Test the relocation functionalities by restarting the boundary app.

Setting up the boundary

# Boundary service

The boundary service is an additional Android service that runs as an OpenXR overlay session. It needs to be started to run in the background while the foreground Spaces applications are running normally at the same time. This is a manual process at the moment and needs this steps to work properly:

  1. Start a Spaces application.
  2. Start the boundary service by running startBoundaryService.bat script.
  3. After starting the service, the environment should be scanned to be mapped and the boundary service to start tracking. These are the events/logs to look for:
    1. The first mapping step is to load the saved anchors. The first snipped below shows how it should look like if this step succeeds.
    2. Next, the boundary service will load these anchors and try to relocate them. It may take up to a minute to finish this part. The second snipped below shows how it should look like if this step succeeds.
    Boundary Service: created anchor store connection succeed!
    Boundary Service: GetSavedAnchor boundary_env0_2
    Boundary Service: GetSavedAnchor boundary_env0_1
    Boundary Service: GetSavedAnchor boundary_env0_3
    Boundary Service: GetSavedAnchor boundary_env0_0
    Boundary Service: locating env: env0
    Boundary Service: CreateSpatialAnchorFromPersistedName,boundary_env0_2
    Boundary Service: CreateSpatialAnchorFromPersistedName,boundary_env0_0
    Boundary Service: CreateSpatialAnchorFromPersistedName,boundary_env0_1
    Boundary Service: CreateSpatialAnchorFromPersistedName,boundary_env0_3
    Boundary Service: CreateSpatialAnchorFromPersistedName,boundary_env0_0 failed!
    Boundary Service: CreateSpatialAnchorFromPersistedName,boundary_env0_3 failed!
    Boundary Service: CreateSpatialAnchorFromPersistedName,boundary_env0_2 succeed!
    Boundary Service: CreateSpatialAnchorFromPersistedName,boundary_env0_1 succeed!
    Boundary Service: locate anchor boundary_env0_2 succeed!
    Boundary Service: locating env: env0 succeed!
  1. If the boundary service was started in debug mode (with the startBoundaryServicet_Debubg.bat script), the service will render objects to visualize the anchors.

  2. The boundary service will render a visual fence if the user is close enough to the boundary (0.5 meters). This will be rendered on top of the running Spaces application.

    Boundary service rendering

    When the user walks out of bounds of the set boundary, VST will be enabled and the foreground game layer will be invisible.

  3. Stop the boundary service by running the stopBoundaryService.bat script.

  4. Stop the Spaces application.

# Known issues

If boundary service is not finding the location where the boundary was set up within a minute, the boundary itself should be recreated. This happens regularly at the moment and will be fixed in future releases.