SpatialLocator SpatialLocator SpatialLocator SpatialLocator Class

Definition

Provides access to the location of a device that's tracked relative to the user's surroundings, such as a HoloLens or other Mixed Reality headset.

public : sealed class SpatialLocator : ISpatialLocator
public sealed class SpatialLocator : ISpatialLocator
Public NotInheritable Class SpatialLocator Implements ISpatialLocator
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10586.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

Remarks

The SpatialLocator class represents a device whose position and orientation can be tracked by Windows relative to the user's surroundings. A SpatialLocator instance is the source for locator-attached and stationary frames of reference. On a Mixed Reality headset such as HoloLens, these frames of reference can be used for holographic rendering and for reasoning about surfaces in the world around the device.

Properties

Locatability Locatability Locatability Locatability

Gets the current state of the device's spatial location system.

public : SpatialLocatability Locatability { get; }
public SpatialLocatability Locatability { get; }
Public ReadOnly Property Locatability As SpatialLocatability
var spatialLocatability = spatialLocator.locatability;

Methods

CreateAttachedFrameOfReferenceAtCurrentHeading() CreateAttachedFrameOfReferenceAtCurrentHeading() CreateAttachedFrameOfReferenceAtCurrentHeading() CreateAttachedFrameOfReferenceAtCurrentHeading()

Creates a frame of reference that's positionally attached to this SpatialLocator with the current orientation as its fixed heading.

public : SpatialLocatorAttachedFrameOfReference CreateAttachedFrameOfReferenceAtCurrentHeading()
public SpatialLocatorAttachedFrameOfReference CreateAttachedFrameOfReferenceAtCurrentHeading()
Public Function CreateAttachedFrameOfReferenceAtCurrentHeading() As SpatialLocatorAttachedFrameOfReference
var spatialLocatorAttachedFrameOfReference = spatialLocator.createAttachedFrameOfReferenceAtCurrentHeading();
Returns
See Also

CreateAttachedFrameOfReferenceAtCurrentHeading(Vector3) CreateAttachedFrameOfReferenceAtCurrentHeading(Vector3) CreateAttachedFrameOfReferenceAtCurrentHeading(Vector3) CreateAttachedFrameOfReferenceAtCurrentHeading(Vector3)

Creates a frame of reference that's positionally attached to this SpatialLocator with the current orientation as its fixed heading and with its origin offset by the specified relative position.

public : SpatialLocatorAttachedFrameOfReference CreateAttachedFrameOfReferenceAtCurrentHeading(Vector3 relativePosition)
public SpatialLocatorAttachedFrameOfReference CreateAttachedFrameOfReferenceAtCurrentHeading(Vector3 relativePosition)
Public Function CreateAttachedFrameOfReferenceAtCurrentHeading(relativePosition As Vector3) As SpatialLocatorAttachedFrameOfReference
var spatialLocatorAttachedFrameOfReference = spatialLocator.createAttachedFrameOfReferenceAtCurrentHeading(relativePosition);
Parameters
relativePosition
Vector3 Vector3 Vector3 Vector3

The positional offset of the origin of the frame of reference, expressed within its coordinate system.

Returns
See Also

CreateAttachedFrameOfReferenceAtCurrentHeading(Vector3, Quaternion) CreateAttachedFrameOfReferenceAtCurrentHeading(Vector3, Quaternion) CreateAttachedFrameOfReferenceAtCurrentHeading(Vector3, Quaternion) CreateAttachedFrameOfReferenceAtCurrentHeading(Vector3, Quaternion)

Creates a frame of reference that's positionally attached to this SpatialLocator with the current orientation as its fixed heading and with its origin offset and rotated by the specified relative position and orientation.

public : SpatialLocatorAttachedFrameOfReference CreateAttachedFrameOfReferenceAtCurrentHeading(Vector3 relativePosition, Quaternion relativeOrientation)
public SpatialLocatorAttachedFrameOfReference CreateAttachedFrameOfReferenceAtCurrentHeading(Vector3 relativePosition, Quaternion relativeOrientation)
Public Function CreateAttachedFrameOfReferenceAtCurrentHeading(relativePosition As Vector3, relativeOrientation As Quaternion) As SpatialLocatorAttachedFrameOfReference
var spatialLocatorAttachedFrameOfReference = spatialLocator.createAttachedFrameOfReferenceAtCurrentHeading(relativePosition, relativeOrientation);
Parameters
relativePosition
Vector3 Vector3 Vector3 Vector3

The positional offset of the origin of the frame of reference, expressed within its coordinate system.

relativeOrientation
Quaternion Quaternion Quaternion Quaternion

The rotation of the origin of the frame of reference, relative to the direction of the heading.

Returns
See Also

CreateAttachedFrameOfReferenceAtCurrentHeading(Vector3, Quaternion, Double) CreateAttachedFrameOfReferenceAtCurrentHeading(Vector3, Quaternion, Double) CreateAttachedFrameOfReferenceAtCurrentHeading(Vector3, Quaternion, Double) CreateAttachedFrameOfReferenceAtCurrentHeading(Vector3, Quaternion, Double)

Creates a frame of reference that's positionally attached to this SpatialLocator with the supplied heading in radians relative to the current orientation and with its origin offset by the specified relative position and orientation.

public : SpatialLocatorAttachedFrameOfReference CreateAttachedFrameOfReferenceAtCurrentHeading(Vector3 relativePosition, Quaternion relativeOrientation, double relativeHeadingInRadians)
public SpatialLocatorAttachedFrameOfReference CreateAttachedFrameOfReferenceAtCurrentHeading(Vector3 relativePosition, Quaternion relativeOrientation, Double relativeHeadingInRadians)
Public Function CreateAttachedFrameOfReferenceAtCurrentHeading(relativePosition As Vector3, relativeOrientation As Quaternion, relativeHeadingInRadians As Double) As SpatialLocatorAttachedFrameOfReference
var spatialLocatorAttachedFrameOfReference = spatialLocator.createAttachedFrameOfReferenceAtCurrentHeading(relativePosition, relativeOrientation, relativeHeadingInRadians);
Parameters
relativePosition
Vector3 Vector3 Vector3 Vector3

The positional offset of the origin of the frame of reference, expressed within its coordinate system.

relativeOrientation
Quaternion Quaternion Quaternion Quaternion

The rotation of the origin of the frame of reference, relative to the direction of the heading.

relativeHeadingInRadians
double Double Double Double

The amount to rotate the fixed heading from the SpatialLocator's current orientation, in radians.

Returns
See Also

CreateStationaryFrameOfReferenceAtCurrentLocation() CreateStationaryFrameOfReferenceAtCurrentLocation() CreateStationaryFrameOfReferenceAtCurrentLocation() CreateStationaryFrameOfReferenceAtCurrentLocation()

Creates a frame of reference that remains stationary relative to the user's surroundings, with its initial origin at the SpatialLocator's current location.

public : SpatialStationaryFrameOfReference CreateStationaryFrameOfReferenceAtCurrentLocation()
public SpatialStationaryFrameOfReference CreateStationaryFrameOfReferenceAtCurrentLocation()
Public Function CreateStationaryFrameOfReferenceAtCurrentLocation() As SpatialStationaryFrameOfReference
var spatialStationaryFrameOfReference = spatialLocator.createStationaryFrameOfReferenceAtCurrentLocation();
Returns
See Also

CreateStationaryFrameOfReferenceAtCurrentLocation(Vector3) CreateStationaryFrameOfReferenceAtCurrentLocation(Vector3) CreateStationaryFrameOfReferenceAtCurrentLocation(Vector3) CreateStationaryFrameOfReferenceAtCurrentLocation(Vector3)

Creates a frame of reference that remains stationary relative to the user's surroundings, with its initial origin at the specified offset from the SpatialLocator's current location.

public : SpatialStationaryFrameOfReference CreateStationaryFrameOfReferenceAtCurrentLocation(Vector3 relativePosition)
public SpatialStationaryFrameOfReference CreateStationaryFrameOfReferenceAtCurrentLocation(Vector3 relativePosition)
Public Function CreateStationaryFrameOfReferenceAtCurrentLocation(relativePosition As Vector3) As SpatialStationaryFrameOfReference
var spatialStationaryFrameOfReference = spatialLocator.createStationaryFrameOfReferenceAtCurrentLocation(relativePosition);
Parameters
relativePosition
Vector3 Vector3 Vector3 Vector3

The positional offset of the origin of the frame of reference, expressed within its coordinate system.

Returns
See Also

CreateStationaryFrameOfReferenceAtCurrentLocation(Vector3, Quaternion) CreateStationaryFrameOfReferenceAtCurrentLocation(Vector3, Quaternion) CreateStationaryFrameOfReferenceAtCurrentLocation(Vector3, Quaternion) CreateStationaryFrameOfReferenceAtCurrentLocation(Vector3, Quaternion)

Creates a frame of reference that remains stationary relative to the user's surroundings, with its initial origin at the specified offset from the SpatialLocator's current location, and then rotated at the specified rotation.

public : SpatialStationaryFrameOfReference CreateStationaryFrameOfReferenceAtCurrentLocation(Vector3 relativePosition, Quaternion relativeOrientation)
public SpatialStationaryFrameOfReference CreateStationaryFrameOfReferenceAtCurrentLocation(Vector3 relativePosition, Quaternion relativeOrientation)
Public Function CreateStationaryFrameOfReferenceAtCurrentLocation(relativePosition As Vector3, relativeOrientation As Quaternion) As SpatialStationaryFrameOfReference
var spatialStationaryFrameOfReference = spatialLocator.createStationaryFrameOfReferenceAtCurrentLocation(relativePosition, relativeOrientation);
Parameters
relativePosition
Vector3 Vector3 Vector3 Vector3

The positional offset of the origin of the frame of reference, expressed within its coordinate system.

relativeOrientation
Quaternion Quaternion Quaternion Quaternion

The rotation of the origin of the frame of reference, relative to the orientation of the SpatialLocator.

Returns
See Also

CreateStationaryFrameOfReferenceAtCurrentLocation(Vector3, Quaternion, Double) CreateStationaryFrameOfReferenceAtCurrentLocation(Vector3, Quaternion, Double) CreateStationaryFrameOfReferenceAtCurrentLocation(Vector3, Quaternion, Double) CreateStationaryFrameOfReferenceAtCurrentLocation(Vector3, Quaternion, Double)

Creates a frame of reference that remains stationary relative to the user's surroundings, with its initial origin at the specified offset from the SpatialLocator's current location along the specified relative heading in radians, and then rotated at the specified rotation.

public : SpatialStationaryFrameOfReference CreateStationaryFrameOfReferenceAtCurrentLocation(Vector3 relativePosition, Quaternion relativeOrientation, double relativeHeadingInRadians)
public SpatialStationaryFrameOfReference CreateStationaryFrameOfReferenceAtCurrentLocation(Vector3 relativePosition, Quaternion relativeOrientation, Double relativeHeadingInRadians)
Public Function CreateStationaryFrameOfReferenceAtCurrentLocation(relativePosition As Vector3, relativeOrientation As Quaternion, relativeHeadingInRadians As Double) As SpatialStationaryFrameOfReference
var spatialStationaryFrameOfReference = spatialLocator.createStationaryFrameOfReferenceAtCurrentLocation(relativePosition, relativeOrientation, relativeHeadingInRadians);
Parameters
relativePosition
Vector3 Vector3 Vector3 Vector3

The positional offset of the origin of the frame of reference, expressed within its coordinate system.

relativeOrientation
Quaternion Quaternion Quaternion Quaternion

The rotation of the origin of the frame of reference, relative to the direction of the heading.

relativeHeadingInRadians
double Double Double Double

The amount to rotate the fixed heading from the SpatialLocator's current orientation, in radians, before the positional offset.

Returns
See Also

GetDefault() GetDefault() GetDefault() GetDefault()

Gets the SpatialLocator instance that tracks the location of the current device, such as a HoloLens, relative to the user's surroundings.

public : static SpatialLocator GetDefault()
public static SpatialLocator GetDefault()
Public Static Function GetDefault() As SpatialLocator
var spatialLocator = Windows.Perception.Spatial.SpatialLocator.getDefault();
Returns

TryLocateAtTimestamp(PerceptionTimestamp, SpatialCoordinateSystem) TryLocateAtTimestamp(PerceptionTimestamp, SpatialCoordinateSystem) TryLocateAtTimestamp(PerceptionTimestamp, SpatialCoordinateSystem) TryLocateAtTimestamp(PerceptionTimestamp, SpatialCoordinateSystem)

Creates a SpatialLocation representing the device's location at the specified timestamp. The coordinates within are expressed relative to the supplied coordinate system.

public : SpatialLocation TryLocateAtTimestamp(PerceptionTimestamp timestamp, SpatialCoordinateSystem coordinateSystem)
public SpatialLocation TryLocateAtTimestamp(PerceptionTimestamp timestamp, SpatialCoordinateSystem coordinateSystem)
Public Function TryLocateAtTimestamp(timestamp As PerceptionTimestamp, coordinateSystem As SpatialCoordinateSystem) As SpatialLocation
var spatialLocation = spatialLocator.tryLocateAtTimestamp(timestamp, coordinateSystem);
Parameters
timestamp
PerceptionTimestamp PerceptionTimestamp PerceptionTimestamp PerceptionTimestamp

The timestamp at which to locate the device.

coordinateSystem
SpatialCoordinateSystem SpatialCoordinateSystem SpatialCoordinateSystem SpatialCoordinateSystem

The coordinate system in which to express the location's coordinates.

Returns

Events

LocatabilityChanged LocatabilityChanged LocatabilityChanged LocatabilityChanged

Occurs when the state of the spatial location system changes.

public : event TypedEventHandler LocatabilityChanged<SpatialLocator, object>
public event TypedEventHandler LocatabilityChanged<SpatialLocator, object>
Public Event TypedEventHandler LocatabilityChanged( Of ( Of SpatialLocator ), ( Of object ))
function onLocatabilityChanged(eventArgs){/* Your code */}


spatialLocator.addEventListener("locatabilityChanged", onLocatabilityChanged);
spatialLocator.removeEventListener("locatabilityChanged", onLocatabilityChanged);

PositionalTrackingDeactivating PositionalTrackingDeactivating PositionalTrackingDeactivating PositionalTrackingDeactivating

Occurs when the device's spatial location system is deactivating due to inactivity.

public : event TypedEventHandler PositionalTrackingDeactivating<SpatialLocator, SpatialLocatorPositionalTrackingDeactivatingEventArgs>
public event TypedEventHandler PositionalTrackingDeactivating<SpatialLocator, SpatialLocatorPositionalTrackingDeactivatingEventArgs>
Public Event TypedEventHandler PositionalTrackingDeactivating( Of ( Of SpatialLocator ), ( Of SpatialLocatorPositionalTrackingDeactivatingEventArgs ))
function onPositionalTrackingDeactivating(eventArgs){/* Your code */}


spatialLocator.addEventListener("positionalTrackingDeactivating", onPositionalTrackingDeactivating);
spatialLocator.removeEventListener("positionalTrackingDeactivating", onPositionalTrackingDeactivating);