SpatialCapability.Anchor
static SpatialCapability Anchor
Description
Spatial anchors, poses the system keeps as stable as it can
relative to the physical world. This allows creating new anchor
entities via SpatialEntity.CreateAnchor.
Examples
Anchors that survive an app restart
Give an anchor a name, and FindAnchor gets it back in a later
session. Placing it again under the same name replaces the old one.
SpatialEntity anchor;
public void LoadAnchor()
{
Spatial.Request(SpatialCapability.Anchor);
anchor = SpatialEntity.FindAnchor("my_anchor");
}
// Call this from a button, a pinch, or wherever the user places content
public void PlaceAnchor(Pose pose)
=> anchor = SpatialEntity.CreateAnchor(pose, "my_anchor");
public void StepAnchor()
{
if (anchor.Tracked.IsActive())
Mesh.Cube.Draw(Material.Default, anchor.Pose.ToMatrix(0.1f));
}
Found an issue with these docs, or have some additional questions? Create an Issue on Github!