The coordinate system determines the axes convention of the mesh, and coordinate units specify the metrics used for the mesh.
Since spatial mapping uses positional tracking to create its map, we recommend using the HD720 video mode at 60fps for optimal results.

Enabling Spatial Mapping

After opening the camera, enable positional tracking using enableTracking() and spatial mapping using enableSpatialMapping() with SpatialMappingParameters default parameters.

Two main Spatial Mapping parameters can be adjusted: resolution and range.

Adjusting Resolution

Mapping resolution can be specified manually (in meters) or through the following presets:

MAPPING_RESOLUTION_HIGH: Set resolution to 2cm. Use this setting to map small areas.

MAPPING_RESOLUTION_MEDIUM: Set resolution to 5cm. Good balance between performance and level of detail.

MAPPING_RESOLUTION_LOW: Set resolution of 8cm. Use this settings to map large areas or create a collision mesh.

Note that high resolution mapping is resource-intensive and slows down mesh updates. Use lower resolutions to get faster mesh updates.

When spatial mapping is running correctly, SPATIAL_MAPPING_STATE_OKis returned. If a system does not allow to reach the framerate required to offer a consistent mapping experience, SPATIAL_MAPPING_STATE_FPS_TOO_LOW is returned. Similarly, if memory limit is reached during mapping, SPATIAL_MAPPING_STATE_NOT_ENOUGH_MEMORY is returned. In both cases, spatial mapping will stop integrating new data into the model, but the 3D model can still be extracted.