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

SpatialEntity.With

static SpatialEntityCollection With(SpatialComponent components)

An enumeration of the spatial entities that have data for all the given components.

   
SpatialComponent components Components each entity must have.
RETURNS: SpatialEntityCollection An enumeration of matching entities.

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!