class Anchor

An Anchor in StereoKit is a completely virtual pose that is pinned to a real-world location. They are creatable via code, generally can persist across sessions, may provide additional stability beyond the system’s 6dof tracking, and are not physical objects!

This functionality is backed by extensions like the Microsoft Spatial Anchor, or the Facebook Spatial Entity. If a proper anchoring system isn’t present on the device, StereoKit will fall back to a stage- relative anchor. Stage-relative anchors may be a good solution for devices with a consistent stage, but may be troublesome if the user adjusts their stage frequently.

A conceptual guide to Anchors:

Instance Fields and Properties

string Id Gets or sets the unique identifier of this asset resource! This can be helpful for debugging, managine your assets, or finding them later on! This is StereoKit’s asset ID, and not the system’s unique Name for the anchor.
string Name A unique system provided name identifying this anchor. This will be the same across sessions for persistent Anchors.
bool Persistent Will this Anchor persist across multiple app sessions? You can use TrySetPersistent to change this value.
Pose Pose The most recently identified Pose of the Anchor. While an Anchor will generally be in the same position once discovered, it may shift slightly to compensate for drift in the device’s 6dof tracking. Anchor Poses when tracked are more accurate than world-space positions.
BtnState Tracked Does the device consider this Anchor to be tracked? This doesn’t require the Anchor to be visible, just that the device knows where this Anchor is located.

Instance Methods

TryGetPerceptionAnchor Tries to get the underlying perception spatial anchor for platforms using Microsoft spatial anchors.
TrySetPersistent This will attempt to make or prevent this Anchor from persisting across app sessions. You may want to check if the system is capable of persisting anchors via Anchors.Capabilities, but it’s possible for this to fail on the OpenXR runtime’s side as well.

Static Fields and Properties

IEnumerable`1 Anchors This is an enumeration of all Anchors that exist in StereoKit at the current moment.
AnchorCaps Capabilities This describes the anchoring capabilities of the current XR anchoring backend. Some systems like a HoloLens can create Anchors that provide stability, and can persist across multiple sessions. Some like SteamVR might be able to make a persistent Anchor that’s relative to the stage, but doesn’t provide any stability benefits.
IEnumerable`1 NewAnchors This is an enumeration of all Anchors that are new to StereoKit this frame.

Static Methods

ClearStored This will remove persistence from all Anchors the app knows about, even if they aren’t tracked.
FromPose This creates a new Anchor from a world space pose.

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