⚠ Preview docs — built from the develop branch and may be unstable. Go to the stable docs.

Spatial.Request

static void Request(SpatialCapability capabilities)

Request tracking for these capabilities, additively! This takes effect asynchronously, and entities will appear in the entity list as the system starts up and discovers them. Requesting or disabling one capability never disturbs entities belonging to another. If a capability needs a permission, this requests it automatically as a fallback, but requesting it yourself in advance via Permission.Request gives you control over when the user is asked, and lets you handle a denial. You can call this before SK.Initialize, and it takes effect once StereoKit starts.

   
SpatialCapability capabilities One or more capabilities to request. Unsupported capabilities never start running.

Examples

Drawing detected planes

Request plane tracking once, and the device’s walls, floors and tables show up in the entity list as it finds them.

public void StartPlanes()
{
	Spatial.Request(SpatialCapability.PlaneTracking);
}

public void StopPlanes()
{
	Spatial.Disable(SpatialCapability.PlaneTracking);
}

public void DrawPlanes()
{
	foreach (SpatialEntity plane in SpatialEntity.With(SpatialComponent.Bounds2D))
	{
		// Quads face Forward, same as the plane's center pose
		plane.TryGetBounds2D(out Pose center, out Vec2 size);
		Mesh.Quad.Draw(Material.Default, center.ToMatrix(new Vec3(size.x, size.y, 1)));
	}
}




Found an issue with these docs, or have some additional questions? Create an Issue on Github!