Boundary system
The Boundary system provides support for visualizing Virtual Reality boundary components in mixed reality applications. Boundaries define the area in which users can safely move around while wearing a VR headset. Boundaries are an important component of a mixed reality experience to help users avoid unseen obstacles while wearing a VR headset.
Many Virtual Reality platforms provide an automatic display, for example a white outline superimposed on the virtual world as the user or their controller nears the boundary. The Mixed Reality Toolkit's Boundary System extends this feature to enable the display of an outline of the tracked area, a floor plane and other features that can be used to provide additional information to users.
Getting started
Adding support for boundaries requires two key components of the Mixed Reality Toolkit: the Boundary System and a Virtual Reality platform configured with a boundary.
- Enable the boundary system
- Configure the boundary visualization
- Build and deploy to a VR platform with a configured boundary
Enable boundary system
The Boundary System is managed by the MixedRealityToolkit object (or another service registrar component).
The following steps presume use of the MixedRealityToolkit object. Steps required for other service registrars may be different.
Select the MixedRealityToolkit object in the scene hierarchy.
Navigate the Inspector panel to the Boundary System section and check Enable
Select the Boundary System implementation. The default class implementation provided by the MRTK is the
MixedRealityBoundarySystem
Note
All Boundary System implementation must extend the IMixedRealityBoundarySystem
Configure boundary visualization
The Boundary System uses a configuration profile to specify which boundary components are to be displayed and to configure their appearance.
Note
Users of the default profile, DefaultMixedRealityBoundaryVisualizationProfile
(Assets/MRTK/SDK/Profiles) will have the boundary system pre-configured to display a floor plane, the play area and the tracked area.
Build and deploy
Once the boundary system is configured with the desired visualization options, the project can be built deployed to the target platform.
Note
Unity Play Mode enables in-editor visualization of the configured boundary. This feature enables rapid development and testing without requiring the build and deploy step. Be sure to do final acceptance testing using an built and deployed version of the application, running on the target hardware and platform.
Accessing boundary system via code
If enabled and configured, the Boundary System can be accessed via the CoreServices static helper class. The reference can then be used to dynamically change the Boundary parameters and access related GameObjects managed by the system.
// Hide Boundary Walls at runtime
CoreServices.BoundarySystem.ShowBoundaryWalls = false;
// Get Unity GameObject for the floor visualization in scene
GameObject floorVisual = CoreServices.BoundarySystem.GetFloorVisualization();