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

Spatial.SetMarkerStationary

static void SetMarkerStationary(MarkerType type, bool stationary)

Tell the system whether markers of this type stay put, like a code taped to a wall, rather than being carried around. Stationary markers can have their pose refined over time instead of re-detected every frame. Changing this while that marker type is being tracked restarts its tracking, so set it before Request when you can. Not all devices use this, treat it as a hint.

   
MarkerType type The marker type this applies to.
bool stationary True if these markers never move.

Examples

Finding an ArUco marker by id

The dictionary must match the markers you printed, or they won’t be detected. AprilTags work the same way, via AprilTagDictionary.

public void StartAruco()
{
	Spatial.ArucoDictionary = ArucoDict.Dict4x4_50;
	// A 10cm printed marker, used by runtimes that support known sizes
	Spatial.SetMarkerSize(MarkerType.Aruco, 0.1f);
	// Markers taped to a wall can have their pose refined over time
	Spatial.SetMarkerStationary(MarkerType.Aruco, true);
	Spatial.Request(SpatialCapability.Aruco);
}

static bool FindMarker(uint id, out Pose pose)
{
	foreach (SpatialEntity marker in SpatialEntity.With(SpatialComponent.Marker))
	{
		if (marker.TryGetMarker(out MarkerType type, out uint markerId) && type == MarkerType.Aruco && markerId == id)
			return marker.TryGetBounds2D(out pose, out _);
	}
	pose = Pose.Identity;
	return false;
}




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