Represents a coordinate system that is strongly anchored to a point in the user's surroundings.
public ref class SpatialAnchor sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 131072)] /// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)] /// [Windows.Foundation.Metadata.Static(Windows.Perception.Spatial.ISpatialAnchorStatics, 131072, "Windows.Foundation.UniversalApiContract")] /// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)] class SpatialAnchor final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 131072)] [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)] [Windows.Foundation.Metadata.Static(typeof(Windows.Perception.Spatial.ISpatialAnchorStatics), 131072, "Windows.Foundation.UniversalApiContract")] [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)] public sealed class SpatialAnchor
Public NotInheritable Class SpatialAnchor
Windows 10 requirements
Windows 10 (introduced in 10.0.10586.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
Windows.Foundation.UniversalApiContract (introduced in v2.0)
You can create a SpatialAnchor at any position and orientation within the SpatialCoordinateSystem of your choosing. The device must be able to locate that coordinate system at the moment, and the system must not have reached its limit of spatial anchors.
Once defined, the coordinate system of a SpatialAnchor adjusts continually to retain the precise position and orientation of its initial location. You can then use this SpatialAnchor to render holograms that will appear fixed in the user's surroundings at that exact location.
The effects of the adjustments that keep the anchor in place are magnified as distance from the anchor increases. You should avoid rendering content relative to an anchor that is more than 3 meters from that anchor's origin.
You can persist a SpatialAnchor using the SpatialAnchorStore class and then get it back in a future app session.
The CoordinateSystem property gets a coordinate system that lets you place content relative to the anchor, with easing applied when the device adjusts the anchor's precise location.
The coordinate system is right-handed, with +y up, +x to the right, and -z forward.
|Windows version||SDK version||Value added|
Gets the coordinate system of the anchor, with easing adjustments applied.
Gets the coordinate system of the anchor, without easing applied.
Gets a value indicating whether the persisted anchor was removed by the user.
Creates an anchor at the origin of the specified coordinate system.
Creates an anchor at a specific position within the specified coordinate system.
|TryCreateRelativeTo(SpatialCoordinateSystem, Vector3, Quaternion)||
Creates an anchor at a specific position and orientation within the specified coordinate system.
This can return null if the system has reached its limit on spatial anchors. It may also return null if the specified coordinate system cannot be located this frame.
Occurs when the device adjusts the anchor's precise location, which updates the RawCoordinateSystem.