Class XrStationaryReferenceSpaceFeature
Allows creation, management, and usage of the stationary reference space on supported XR runtimes.
Inherited Members
Namespace: UnityEngine.XR.OpenXR.Features.Extensions.StationaryReferenceSpace
Assembly: Unity.XR.OpenXR.dll
Syntax
public class XrStationaryReferenceSpaceFeature : OpenXRFeature
Fields
extensionString
Name of the OpenXR extension for stationary reference space.
Declaration
public const string extensionString = "XR_EXT_stationary_reference_space"
Field Value
| Type | Description |
|---|---|
| string |
featureId
The feature id string for stationary reference space.
Declaration
public const string featureId = "com.unity.openxr.feature.extension.stationary_reference_space"
Field Value
| Type | Description |
|---|---|
| string |
Methods
DestroyStationaryReferenceSpace()
Destroys the stationary reference space, if one is currently valid.
Declaration
public void DestroyStationaryReferenceSpace()
GetStationarySpaceGenerationId(out XrUuid)
Attempts to get the generation ID of the current stationary reference space. The XR runtime assigns a new generation ID when it can't relocate the previous stationary reference space origin and starts a new one. Recentering doesn't change the generation ID.
Declaration
public OpenXRResultStatus GetStationarySpaceGenerationId(out XrUuid generationId)
Parameters
| Type | Name | Description |
|---|---|---|
| XrUuid | generationId | The generation ID of the stationary reference space if successful. empty otherwise. |
Returns
| Type | Description |
|---|---|
| OpenXRResultStatus | The result of the operation. Implicitly converts to
|
InitializeStationaryReferenceSpace()
Initializes a stationary reference space with the identity pose in space's own coordinate system.
Declaration
public OpenXRResultStatus InitializeStationaryReferenceSpace()
Returns
| Type | Description |
|---|---|
| OpenXRResultStatus | The result of the operation. Implicitly converts to
|
Remarks
If a stationary reference space already exists, it's destroyed first.
InitializeStationaryReferenceSpace(Pose)
Initializes a stationary reference space with the specified pose offset in space's own coordinate system.
Declaration
public OpenXRResultStatus InitializeStationaryReferenceSpace(Pose poseOffset)
Parameters
| Type | Name | Description |
|---|---|---|
| Pose | poseOffset | The pose offset, in the stationary reference space's own coordinate system. |
Returns
| Type | Description |
|---|---|
| OpenXRResultStatus | The result of the operation. Implicitly converts to
|
Remarks
If a stationary reference space already exists, it's destroyed first.
IsStationarySpaceValid()
Checks whether the stationary reference space is currently valid.
Declaration
public bool IsStationarySpaceValid()
Returns
| Type | Description |
|---|---|
| bool | True if and only if the stationary reference space is valid, false otherwise. |
LocateAppSpaceInStationarySpace(out Pose, out XrSpaceLocationFlags)
Locates the current application input tracking space in the stationary reference space.
Declaration
public OpenXRResultStatus LocateAppSpaceInStationarySpace(out Pose appSpaceInStationarySpace, out XrSpaceLocationFlags locationFlags)
Parameters
| Type | Name | Description |
|---|---|---|
| Pose | appSpaceInStationarySpace | The pose of application space relative to stationary space. |
| XrSpaceLocationFlags | locationFlags | Which parts of the pose are valid and tracked. None if the call failed. |
Returns
| Type | Description |
|---|---|
| OpenXRResultStatus | The result of the operation. Implicitly converts to
|
Remarks
While the runtime relocates the stationary reference space, the call can succeed with some location flags cleared. The position or orientation is identity while its valid flag is cleared.
LocateStationarySpaceInAppSpace(out Pose, out XrSpaceLocationFlags)
Locates the stationary reference space in the current application input tracking space.
Declaration
public OpenXRResultStatus LocateStationarySpaceInAppSpace(out Pose stationarySpaceInAppSpace, out XrSpaceLocationFlags locationFlags)
Parameters
| Type | Name | Description |
|---|---|---|
| Pose | stationarySpaceInAppSpace | The pose of stationary space relative to application space. |
| XrSpaceLocationFlags | locationFlags | Which parts of the pose are valid and tracked. None if the call failed. |
Returns
| Type | Description |
|---|---|
| OpenXRResultStatus | The result of the operation. Implicitly converts to
|
Remarks
While the runtime relocates the stationary reference space, the call can succeed with some location flags cleared. The position or orientation is identity while its valid flag is cleared.
LocateStationarySpaceInBaseSpace(ulong, out Pose, out XrSpaceLocationFlags)
Attempts to locate stationary space relative to the given base space.
Declaration
public OpenXRResultStatus LocateStationarySpaceInBaseSpace(ulong baseSpace, out Pose stationarySpaceInBaseSpace, out XrSpaceLocationFlags locationFlags)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | baseSpace | The XrSpace handle to locate stationary space relative to, as a ulong. |
| Pose | stationarySpaceInBaseSpace | The pose of stationary space relative to the given base space. |
| XrSpaceLocationFlags | locationFlags | Which parts of the pose are valid and tracked. None if the call failed. |
Returns
| Type | Description |
|---|---|
| OpenXRResultStatus | The result of the operation. Implicitly converts to
|
Remarks
While the runtime relocates the stationary reference space, the call can succeed with some location flags cleared. The position or orientation is identity while its valid flag is cleared.
LocateTargetSpaceInStationarySpace(ulong, out Pose, out XrSpaceLocationFlags)
Attempts to locate a target space in the stationary reference space.
Declaration
public OpenXRResultStatus LocateTargetSpaceInStationarySpace(ulong targetSpace, out Pose targetSpaceInStationarySpace, out XrSpaceLocationFlags locationFlags)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | targetSpace | The XrSpace handle of the space to locate in Stationary Space. |
| Pose | targetSpaceInStationarySpace | The pose of the target space relative to stationary space. |
| XrSpaceLocationFlags | locationFlags | Which parts of the pose are valid and tracked. None if the call failed. |
Returns
| Type | Description |
|---|---|
| OpenXRResultStatus | The result of the operation. Implicitly converts to
|
Remarks
While the runtime relocates the stationary reference space, the call can succeed with some location flags cleared. The position or orientation is identity while its valid flag is cleared.
OnInstanceCreate(ulong)
Called after xrCreateInstance. Override this method to validate that any necessary OpenXR extensions were
successfully enabled (OpenXRRuntime.IsExtensionEnabled)
and that any required system properties are supported. If this method returns false,
the feature's enabled property is set to false.
Declaration
protected override bool OnInstanceCreate(ulong xrInstance)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | xrInstance | Handle of the native |
Returns
| Type | Description |
|---|---|
| bool | true if this feature successfully initialized. Otherwise, false. |
Overrides
Remarks
If this feature is a required feature of an enabled feature set, returning false here
causes the OpenXRLoader to fail, and XR Plug-in Management will fall back to another loader if enabled.
See Also
OnReferenceSpaceChanged(ulong, Pose?)
Called when a reference space changes. When the reference space and the app space are changed on the same frame, this is called before UnityEngine.XR.XRInputSubsystem.trackingOriginUpdated.
Declaration
protected override void OnReferenceSpaceChanged(ulong referenceSpaceType, Pose? poseInPreviousSpace)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | referenceSpaceType | The reference space type that is changing. |
| Pose? | poseInPreviousSpace | Pose in the previous space, if available. Null if not available. |
Overrides
Events
stationarySpaceChanged
This Action is invoked when the underlying OpenXR runtime sends a space change event for stationary space. This is invoked on the first frame when the associated event's XrTime has passed. When stationary space and the app space are changed on the same frame, stationary space's event will be invoked before UnityEngine.XR.XRInputSubsystem.trackingOriginUpdated.
Declaration
public event Action<XrStationaryReferenceSpaceFeature.StationarySpaceChangedEventArgs> stationarySpaceChanged
Event Type
| Type | Description |
|---|---|
| Action<XrStationaryReferenceSpaceFeature.StationarySpaceChangedEventArgs> |