OpenXRSpatialEntityTracker
OpenXR spatial-entity tracking data.
Provider RefCounted data, not a game-tree Entity or ECS. Uses the XRServer Anchor category; XRAnchor3D under XROrigin3D binds by Name and default pose. Require both SpatialTrackingState=Tracking and pose HasTrackingData. Manually setting state creates no tracking.
Entity is a backend RID managed by the tracker; do not free it independently. SpatialContext cannot switch after its first assignment. Name/RID are not persistence UUIDs. Additional Next structures form a linked list; duplicate insertion can create cycles.
Executed example and setup. Windows headless XR-off covered synthetic metadata/client logic: 23 API cases and an earlier 20 helper checks. Real discovery, entity/context RIDs, persistence, headsets and imagery remain untested. Do not dispose provider-owned trackers/poses/cached wrappers; dispose a newly owned tracker after use.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
OpenXRSpatialEntityTrackerConstructor
public OpenXRSpatialEntityTracker();Creates a caller-owned RefCounted tracker without starting OpenXR, registering with XRServer or detecting anything. Base state is Paused, category Anchor, entity/context RIDs empty. Real applications normally use the borrowed provider-registered tracker rather than a synthetic resource. Release your own instance after removing owned references/registration.
Properties2
EntityProperty
public Rid Entity { get; set; }Runtime spatial-entity RID, not a game-tree Entity or persistence UUID. Initially empty. Assignment gives the tracker responsibility for this RID: replacing/destroying the tracker frees its previous entity through the spatial extension. Do not free a built-in tracker RID yourself or assign arbitrary Rids; IsValid does not verify a live owner.
SpatialTrackingStateProperty
public OpenXRSpatialEntityTracker.EntityTrackingState SpatialTrackingState { get; set; }Spatial tracking state, initially Paused: Tracking, Paused or Stopped. The setter updates metadata and emits SpatialTrackingStateChanged on change; it creates no pose, starts no discovery and validates no position. Also require GetPose("default").HasTrackingData before using a pose.
Methods9
AddNextvoid
public void AddNext(OpenXRStructureBase next);Prepends a structure, setting its Next to the previous head. Null is ignored; a successful addition emits NextChanged. Mutates the supplied structure links; use a distinct instance and never insert an already linked structure again, which can create a cycle. Requests no runtime capability.
| Name | Type | Default |
|---|---|---|
next | OpenXRStructureBase | — |
nextPrepends a structure, setting its Next to the previous head. Null is ignored; a successful addition emits NextChanged. Mutates the supplied structure links; use a distinct instance and never insert an already linked structure again, which can create a cycle. Requests no runtime capability.
GetEntityRid
public Rid GetEntity();Runtime spatial-entity RID, not a game-tree Entity or persistence UUID. Initially empty. Assignment gives the tracker responsibility for this RID: replacing/destroying the tracker frees its previous entity through the spatial extension. Do not free a built-in tracker RID yourself or assign arbitrary Rids; IsValid does not verify a live owner.
RidRuntime spatial-entity RID, not a game-tree Entity or persistence UUID. Initially empty. Assignment gives the tracker responsibility for this RID: replacing/destroying the tracker frees its previous entity through the spatial extension. Do not free a built-in tracker RID yourself or assign arbitrary Rids; IsValid does not verify a live owner.
GetNextOpenXRStructureBase
public OpenXRStructureBase GetNext();Borrowed first OpenXRStructureBase in the additional-structure chain, or null. A linked extension-parameter list, not child Entities. Do not mutate/dispose provider-owned structures; detach newly owned structures before releasing them.
OpenXRStructureBaseBorrowed first OpenXRStructureBase in the additional-structure chain, or null. A linked extension-parameter list, not child Entities. Do not mutate/dispose provider-owned structures; detach newly owned structures before releasing them.
GetSpatialContextRid
public Rid GetSpatialContext();Spatial-context RID, initially empty. After a valid RID is assigned, the setter rejects a different context, including empty; create a new tracker instead. Reading transfers no context ownership; do not free engine-owned default contexts. The setter does not establish OpenXR context readiness.
RidSpatial-context RID, initially empty. After a valid RID is assigned, the setter rejects a different context, including empty; create a new tracker instead. Reading transfers no context ownership; do not free engine-owned default contexts. The setter does not establish OpenXR context readiness.
GetSpatialTrackingStateOpenXRSpatialEntityTracker.EntityTrackingState
public OpenXRSpatialEntityTracker.EntityTrackingState GetSpatialTrackingState();Spatial tracking state, initially Paused: Tracking, Paused or Stopped. The setter updates metadata and emits SpatialTrackingStateChanged on change; it creates no pose, starts no discovery and validates no position. Also require GetPose("default").HasTrackingData before using a pose.
OpenXRSpatialEntityTracker.EntityTrackingStateSpatial tracking state, initially Paused: Tracking, Paused or Stopped. The setter updates metadata and emits SpatialTrackingStateChanged on change; it creates no pose, starts no discovery and validates no position. Also require GetPose("default").HasTrackingData before using a pose.
RemoveNextvoid
public void RemoveNext(OpenXRStructureBase next);Unlinks the first matching reference, clears that structure Next and emits NextChanged. Null/absent entries do nothing. Destroys no resource and cancels no submitted asynchronous request; do not edit provider-owned chains.
| Name | Type | Default |
|---|---|---|
next | OpenXRStructureBase | — |
nextUnlinks the first matching reference, clears that structure Next and emits NextChanged. Null/absent entries do nothing. Destroys no resource and cancels no submitted asynchronous request; do not edit provider-owned chains.
SetEntityvoid
public void SetEntity(Rid entity);Runtime spatial-entity RID, not a game-tree Entity or persistence UUID. Initially empty. Assignment gives the tracker responsibility for this RID: replacing/destroying the tracker frees its previous entity through the spatial extension. Do not free a built-in tracker RID yourself or assign arbitrary Rids; IsValid does not verify a live owner.
| Name | Type | Default |
|---|---|---|
entity | Rid | — |
entityRuntime spatial-entity RID, not a game-tree Entity or persistence UUID. Initially empty. Assignment gives the tracker responsibility for this RID: replacing/destroying the tracker frees its previous entity through the spatial extension. Do not free a built-in tracker RID yourself or assign arbitrary Rids; IsValid does not verify a live owner.
SetSpatialContextvoid
public void SetSpatialContext(Rid spatialContext);Spatial-context RID, initially empty. After a valid RID is assigned, the setter rejects a different context, including empty; create a new tracker instead. Reading transfers no context ownership; do not free engine-owned default contexts. The setter does not establish OpenXR context readiness.
| Name | Type | Default |
|---|---|---|
spatialContext | Rid | — |
spatialContextSpatial-context RID, initially empty. After a valid RID is assigned, the setter rejects a different context, including empty; create a new tracker instead. Reading transfers no context ownership; do not free engine-owned default contexts. The setter does not establish OpenXR context readiness.
SetSpatialTrackingStatevoid
public void SetSpatialTrackingState(OpenXRSpatialEntityTracker.EntityTrackingState spatialTrackingState);Spatial tracking state, initially Paused: Tracking, Paused or Stopped. The setter updates metadata and emits SpatialTrackingStateChanged on change; it creates no pose, starts no discovery and validates no position. Also require GetPose("default").HasTrackingData before using a pose.
| Name | Type | Default |
|---|---|---|
spatialTrackingState | OpenXRSpatialEntityTracker.EntityTrackingState | — |
spatialTrackingStateSpatial tracking state, initially Paused: Tracking, Paused or Stopped. The setter updates metadata and emits SpatialTrackingStateChanged on change; it creates no pose, starts no discovery and validates no position. Also require GetPose("default").HasTrackingData before using a pose.
Signals and events2
NextChangedEvent
public event Action NextChanged;Additional-structure list change through AddNext/RemoveNext. Establishes no changed pose, discovery or runtime application. Directly changing a structure Next need not pass through this signal.
SpatialTrackingStateChangedEvent
public event OpenXRSpatialEntityTracker.SpatialTrackingStateChangedEventHandler SpatialTrackingStateChanged;Spatial-state change signal; its C# argument is long. Convert to EntityTrackingState after checking the expected value. Reassigning an equal state emits nothing. This establishes neither valid pose nor ready geometry; handle visibility and collision separately.
| Name | Type | Default |
|---|---|---|
spatialTrackingState | long | — |
spatialTrackingStateNew state as long corresponding to EntityTrackingState; does not establish valid pose.
OpenXRSpatialEntityTracker.EntityTrackingState
| Value | Description |
|---|---|
Paused = 2 | Tracking is currently paused. |
Stopped = 1 | This anchor has stopped tracking. |
Tracking = 3 | This anchor is currently being tracked. |