|
| 1 | +# Spatial Awareness |
| 2 | + |
| 3 | +The Spatial Awareness system provides real-world environmental awareness in mixed reality applications. When introduced on Microsoft HoloLens, spatial awareness provided a collection of meshes, representing the geometry of the environment, which allowed for compelling interactions between holograms and the real-world. |
| 4 | + |
| 5 | +## Getting Started |
| 6 | + |
| 7 | +Adding support for spatial awareness requires two key components of the Mixed Reality Toolkit; the spatial awareness system and a supported platform provider. |
| 8 | + |
| 9 | +1. [Enable](enable-spatial-awareness) the spatial awareness system |
| 10 | +2. [Register](register-observers) and [configure](configure-observers) one or more spatial observers |
| 11 | +3. [Build and deploy](build-and-deploy) to a platform that supports spatial awareness |
| 12 | + |
| 13 | +### Enable Spatial Awareness |
| 14 | + |
| 15 | +The spatial awareness system is managed by the MixedRealityToolkit object (or another [service registrar](xref:Microsoft.MixedReality.Toolkit.IMixedRealityServiceRegistrar) component). |
| 16 | + |
| 17 | +``` |
| 18 | +Note: |
| 19 | +The following steps presume use of the MixedRealityToolkit object. Steps required for other service registrars may be different. |
| 20 | +``` |
| 21 | +1. Select the MixedRealityToolkit object in the scene hierarchy. |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | +2. Navigate the Inspector panel to the Spatial Awareness System section and check Enable |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +3. Select the Spatial Awareness System implementation |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | +``` |
| 34 | +Note: |
| 35 | +Users of the default profile (DefaultMixedRealityToolkitConfigurationProfile) will have the spatial awareness system pre-configured to use the MixedRealitySpatialAwarenessSystem from the Mixed Reality Toolkit Spatial Awareness Service package. |
| 36 | +``` |
| 37 | + |
| 38 | +### Register observers |
| 39 | + |
| 40 | +Before the spatial awareness system can provide applications with data about the real-world, at least one spatial observer must be registered. Spatial observers are generally platform specific components that may vary in the type(s) of data (ex: meshes) provided. |
| 41 | + |
| 42 | +1. Open or expand the Spatial Awareness System profile |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | +2. Click "Add Spatial Observer" |
| 47 | +3. Select the Spatial Observer implementation |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | +``` |
| 52 | +Note: |
| 53 | +Users of the default profile (DefaultMixedRealitSpatialAwarenessSystemProfile) will have the spatial awareness system pre-configured to use the WindowsMixedRealitySpatialMeshObserver from the Mixed Reality Toolkit Windows Mixed Reality Provider package. |
| 54 | +``` |
| 55 | + |
| 56 | +#### Configure observers |
| 57 | + |
| 58 | +Once the spatial observer(s) have been registered with the system, they can be configured to provide the desired data. |
| 59 | + |
| 60 | +``` |
| 61 | +Note: |
| 62 | +When configuring a spatial observer, many implementations will auto-populate the observer's configuration profile with common default values. |
| 63 | +``` |
| 64 | + |
| 65 | +1. Open or expand the Spatial Observer profile |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | +2. Configure the desired options |
| 70 | + |
| 71 | +The illustration in the previous step shows the configuration profile for a spatial mesh observer. Please see [Spatial Mesh Observer profile](../TODO.md) for more information pertaining to the specific settings available to mesh observers. Other observers may have similar settings. |
| 72 | + |
| 73 | +### Build and Deploy |
| 74 | + |
| 75 | +Once the spatial awareness system is configured with the desired observer(s), the project can be built and deployed to the target platform. |
| 76 | + |
| 77 | +``` |
| 78 | +Note: |
| 79 | +Some platforms, including Microsoft HoloLens, provide support for remote execution from within Unity. This feature enables rapid development and testing without requring the build and deploy step. |
| 80 | +
|
| 81 | +Be sure to do final acceptance testing using an built and deployed version of the application, running on suported hardware before releasing. |
| 82 | +``` |
| 83 | + |
| 84 | +## See Also |
| 85 | + |
| 86 | +- [Spatial Awareness API documentation](xref:Microsoft.MixedReality.Toolkit.SpatialAwareness) |
| 87 | +- [Spatial Mesh Observer profile](../TODO.md) |
| 88 | +- [Using Spatial Awareness in an application](../TODO.md) |
| 89 | + |
| 90 | + |
0 commit comments