reckfellENGINE

OpenXRSpatialEntityExtension

OpenXR extension that handles spatial entities.

On this page
class OpenXRSpatialEntityExtensionReckfellSharpInherits OpenXRExtensionWrapper

OpenXR extension that handles spatial entities.

OpenXR extension that handles spatial entities and, when enabled, allows querying those spatial entities. This extension will also automatically manage XRTracker objects for static entities.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

OpenXRSpatialEntityExtensionConstructor
# OpenXRSpatialEntityExtension
C#
public OpenXRSpatialEntityExtension();

Methods29

AddSpatialEntityRid
# AddSpatialEntity
C#
public Rid AddSpatialEntity(Rid spatialContext, ulong entityId, ulong entity);

Registers an entity that was created directly on the OpenXR runtime.

Parameters
NameTypeDefault
spatialContextRid—
entityIdulong—
entityulong—
Returns Rid
CreateSpatialContext2 overloads
# CreateSpatialContext · 1/2
C#
public OpenXRFutureResult CreateSpatialContext(Reckfell.Collections.Array<OpenXRSpatialCapabilityConfigurationBaseHeader> capabilityConfigurations, OpenXRStructureBase next, Callable userCallback);

Creates a new spatial context that handles entities for the provided capability configurations. capability_configurations is an array of OpenXRSpatialCapabilityConfigurationBaseHeader with the needed capability configuration data. next is an optional parameter that can contain additional information for creating our spatial context. Note: This is an asynchronous method and returns an OpenXRFutureResult object with which to track the status, discarding this object will not cancel the creation process. On success user_callback will be called if specified. The result data for this function is the Rid for our spatial context - the argument will be the OpenXR result code (as an integer). On failure failed_callback will be called if specified. The OpenXR result code will be supplied as an integer - the arguments will be the OpenXR result code (as an integer) and a boolean indicating whether requesting the result failed, or the execution failed.

Parameters
NameTypeDefault
capabilityConfigurationsReckfell.Collections.Array<OpenXRSpatialCapabilityConfigurationBaseHeader>—
nextOpenXRStructureBase—
userCallbackCallable—
Returns OpenXRFutureResult
# CreateSpatialContext · 2/2
C#
public OpenXRFutureResult CreateSpatialContext(Reckfell.Collections.Array<OpenXRSpatialCapabilityConfigurationBaseHeader> capabilityConfigurations, OpenXRStructureBase next = null, Callable userCallback = default, Callable failedCallback = default);

Creates a new spatial context that handles entities for the provided capability configurations. capability_configurations is an array of OpenXRSpatialCapabilityConfigurationBaseHeader with the needed capability configuration data. next is an optional parameter that can contain additional information for creating our spatial context. Note: This is an asynchronous method and returns an OpenXRFutureResult object with which to track the status, discarding this object will not cancel the creation process. On success user_callback will be called if specified. The result data for this function is the Rid for our spatial context - the argument will be the OpenXR result code (as an integer). On failure failed_callback will be called if specified. The OpenXR result code will be supplied as an integer - the arguments will be the OpenXR result code (as an integer) and a boolean indicating whether requesting the result failed, or the execution failed.

Parameters
NameTypeDefault
capabilityConfigurationsReckfell.Collections.Array<OpenXRSpatialCapabilityConfigurationBaseHeader>—
nextOpenXRStructureBasenull
userCallbackCallabledefault
failedCallbackCallabledefault
Returns OpenXRFutureResult
DiscoverSpatialEntities2 overloads
# DiscoverSpatialEntities · 1/2
C#
public OpenXRFutureResult DiscoverSpatialEntities(Rid spatialContext, long[] componentTypes, OpenXRStructureBase next = null, Callable userCallback = default);

Starts a new discovery query, this will gather all objects tracked by the spatial_context that have at least one of the component types specified in component_types. next is an optional parameter that can contain additional information for executing the discovery query. Note: This is an asynchronous method and returns an OpenXRFutureResult object with which to track the status, discarding this object will not cancel the discovery process. On success user_callback will be called if specified. The result data for this function is the Rid for our snapshot.

Parameters
NameTypeDefault
spatialContextRid—
componentTypeslong[]—
nextOpenXRStructureBasenull
userCallbackCallabledefault
Returns OpenXRFutureResult
# DiscoverSpatialEntities · 2/2
C#
public OpenXRFutureResult DiscoverSpatialEntities(Rid spatialContext, ReadOnlySpan<long> componentTypes, OpenXRStructureBase next, Callable userCallback);

Starts a new discovery query, this will gather all objects tracked by the spatial_context that have at least one of the component types specified in component_types. next is an optional parameter that can contain additional information for executing the discovery query. Note: This is an asynchronous method and returns an OpenXRFutureResult object with which to track the status, discarding this object will not cancel the discovery process. On success user_callback will be called if specified. The result data for this function is the Rid for our snapshot.

Parameters
NameTypeDefault
spatialContextRid—
componentTypesReadOnlySpan<long>—
nextOpenXRStructureBase—
userCallbackCallable—
Returns OpenXRFutureResult
DiscoverSpatialEntitiesWithComponentDataOpenXRFutureResult
# DiscoverSpatialEntitiesWithComponentData
C#
public OpenXRFutureResult DiscoverSpatialEntitiesWithComponentData(Rid spatialContext, Reckfell.Collections.Array<OpenXRSpatialComponentData> componentData, OpenXRStructureBase next = null, Callable userCallback = default);

Convenience method when the caller only has an Reckfell.Collections.Array of OpenXRSpatialComponentData and needs to discover spatial entities.

Parameters
NameTypeDefault
spatialContextRid—
componentDataReckfell.Collections.Array<OpenXRSpatialComponentData>—
nextOpenXRStructureBasenull
userCallbackCallabledefault
Returns OpenXRFutureResult
FindSpatialEntityRid
# FindSpatialEntity
C#
public Rid FindSpatialEntity(ulong entityId);

Returns the Rid for the specified spatial entity ID.

Parameters
NameTypeDefault
entityIdulong—
Returns Rid
FreeSpatialContextvoid
# FreeSpatialContext
C#
public void FreeSpatialContext(Rid spatialContext);

Frees a spatial context previously created when calling OpenXRSpatialEntityExtension.CreateSpatialContext. If the spatial context creation is still ongoing, the asynchronous process is cancelled.

Parameters
NameTypeDefault
spatialContextRid—
FreeSpatialEntityvoid
# FreeSpatialEntity
C#
public void FreeSpatialEntity(Rid entity);

Frees an entity previously created when calling OpenXRSpatialEntityExtension.AddSpatialEntity or OpenXRSpatialEntityExtension.MakeSpatialEntity.

Parameters
NameTypeDefault
entityRid—
FreeSpatialSnapshotvoid
# FreeSpatialSnapshot
C#
public void FreeSpatialSnapshot(Rid spatialSnapshot);

Frees a spatial snapshot previously created when calling OpenXRSpatialEntityExtension.DiscoverSpatialEntities. If the spatial snapshot creation is still ongoing, the asynchronous process is cancelled.

Parameters
NameTypeDefault
spatialSnapshotRid—
GetFloatBufferfloat[]
# GetFloatBuffer
C#
public float[] GetFloatBuffer(Rid spatialSnapshot, ulong bufferId);

Returns a buffer with floats from a buffer that was retrieved when taking a snapshot.

Parameters
NameTypeDefault
spatialSnapshotRid—
bufferIdulong—
Returns float[]
GetSpatialContextHandleulong
# GetSpatialContextHandle
C#
public ulong GetSpatialContextHandle(Rid spatialContext);

Returns the OpenXR spatial context handle for this snapshot. Note: This method is intended to be used from ReckfellExtensions that implement spatial entity capability handlers.

Parameters
NameTypeDefault
spatialContextRid—
Returns ulong
GetSpatialContextReadybool
# GetSpatialContextReady
C#
public bool GetSpatialContextReady(Rid spatialContext);

Returns true if the spatial context finished its creation and is ready to be used.

Parameters
NameTypeDefault
spatialContextRid—
Returns bool
GetSpatialEntityContextRid
# GetSpatialEntityContext
C#
public Rid GetSpatialEntityContext(Rid entity);

Returns the spatial context for this entity.

Parameters
NameTypeDefault
entityRid—
Returns Rid
GetSpatialEntityIdulong
# GetSpatialEntityId
C#
public ulong GetSpatialEntityId(Rid entity);

Returns the internal XrSpatialEntityIdEXT associated with the entity.

Parameters
NameTypeDefault
entityRid—
Returns ulong
GetSpatialSnapshotContextRid
# GetSpatialSnapshotContext
C#
public Rid GetSpatialSnapshotContext(Rid spatialSnapshot);

Returns the spatial context related to this spatial snapshot.

Parameters
NameTypeDefault
spatialSnapshotRid—
Returns Rid
GetSpatialSnapshotHandleulong
# GetSpatialSnapshotHandle
C#
public ulong GetSpatialSnapshotHandle(Rid spatialSnapshot);

Returns the OpenXR spatial snapshot handle for this snapshot. Note: This method is intended to be used from ReckfellExtensions that implement spatial entity capability handlers.

Parameters
NameTypeDefault
spatialSnapshotRid—
Returns ulong
GetStringstring
# GetString
C#
public string GetString(Rid spatialSnapshot, ulong bufferId);

Returns a string from a buffer that was retrieved when taking a snapshot.

Parameters
NameTypeDefault
spatialSnapshotRid—
bufferIdulong—
Returns string
GetUint16Bufferint[]
# GetUint16Buffer
C#
public int[] GetUint16Buffer(Rid spatialSnapshot, ulong bufferId);

Returns a buffer with 16 bit ints from a buffer that was retrieved when taking a snapshot.

Parameters
NameTypeDefault
spatialSnapshotRid—
bufferIdulong—
Returns int[]
GetUint32Bufferint[]
# GetUint32Buffer
C#
public int[] GetUint32Buffer(Rid spatialSnapshot, ulong bufferId);

Returns a buffer with 32 bit ints from a buffer that was retrieved when taking a snapshot.

Parameters
NameTypeDefault
spatialSnapshotRid—
bufferIdulong—
Returns int[]
GetUint8Bufferbyte[]
# GetUint8Buffer
C#
public byte[] GetUint8Buffer(Rid spatialSnapshot, ulong bufferId);

Returns a buffer with 8 bit ints from a buffer that was retrieved when taking a snapshot.

Parameters
NameTypeDefault
spatialSnapshotRid—
bufferIdulong—
Returns byte[]
GetVector2BufferVector2[]
# GetVector2Buffer
C#
public Vector2[] GetVector2Buffer(Rid spatialSnapshot, ulong bufferId);

Returns a buffer with Vector2 entries from a buffer that was retrieved when taking a snapshot.

Parameters
NameTypeDefault
spatialSnapshotRid—
bufferIdulong—
Returns Vector2[]
GetVector3BufferVector3[]
# GetVector3Buffer
C#
public Vector3[] GetVector3Buffer(Rid spatialSnapshot, ulong bufferId);

Returns a buffer with Vector3 entries from a buffer that was retrieved when taking a snapshot.

Parameters
NameTypeDefault
spatialSnapshotRid—
bufferIdulong—
Returns Vector3[]
MakeSpatialEntityRid
# MakeSpatialEntity
C#
public Rid MakeSpatialEntity(Rid spatialContext, ulong entityId);

Creates a new entity for this entity_id. The spatial_context should match the context that discovered the entity.

Parameters
NameTypeDefault
spatialContextRid—
entityIdulong—
Returns Rid
QuerySnapshotbool
# QuerySnapshot
C#
public bool QuerySnapshot(Rid spatialSnapshot, Reckfell.Collections.Array<OpenXRSpatialComponentData> componentData, OpenXRStructureBase next = null);

Queries the snapshot data. This will find all entities in the snapshot that contain all requested components in component_data. The objects held within component_data will then be populated with the queried data. component_data must always have an object of OpenXRSpatialQueryResultData as the first entry. next is an optional parameter that can contain additional information passed when setting our query conditions.

Parameters
NameTypeDefault
spatialSnapshotRid—
componentDataReckfell.Collections.Array<OpenXRSpatialComponentData>—
nextOpenXRStructureBasenull
Returns bool
SupportsCapabilitybool
# SupportsCapability
C#
public bool SupportsCapability(OpenXRSpatialEntityExtension.Capability capability);

Returns true if this spatial entity capability is supported by the hardware used.

Parameters
NameTypeDefault
capabilityOpenXRSpatialEntityExtension.Capability—
Returns bool
SupportsComponentTypebool
# SupportsComponentType
C#
public bool SupportsComponentType(OpenXRSpatialEntityExtension.Capability capability, OpenXRSpatialEntityExtension.ComponentType componentType);

Returns true if this capability supports the component_type.

Parameters
NameTypeDefault
capabilityOpenXRSpatialEntityExtension.Capability—
componentTypeOpenXRSpatialEntityExtension.ComponentType—
Returns bool
UpdateSpatialEntities2 overloads
# UpdateSpatialEntities · 1/2
C#
public Rid UpdateSpatialEntities(Rid spatialContext, Reckfell.Collections.Array<Rid> entities, long[] componentTypes, OpenXRStructureBase next = null);

Performs a snapshot for a limited number of entities. This is NOT an asynchronous method and will return the snapshot immediately.

Parameters
NameTypeDefault
spatialContextRid—
entitiesReckfell.Collections.Array<Rid>—
componentTypeslong[]—
nextOpenXRStructureBasenull
Returns Rid
# UpdateSpatialEntities · 2/2
C#
public Rid UpdateSpatialEntities(Rid spatialContext, Reckfell.Collections.Array<Rid> entities, ReadOnlySpan<long> componentTypes, OpenXRStructureBase next);

Performs a snapshot for a limited number of entities. This is NOT an asynchronous method and will return the snapshot immediately.

Parameters
NameTypeDefault
spatialContextRid—
entitiesReckfell.Collections.Array<Rid>—
componentTypesReadOnlySpan<long>—
nextOpenXRStructureBase—
Returns Rid

Signals and events1

SpatialDiscoveryRecommendedEvent
# SpatialDiscoveryRecommended
C#
public event OpenXRSpatialEntityExtension.SpatialDiscoveryRecommendedEventHandler SpatialDiscoveryRecommended;

Emitted when OpenXR recommends running a discovery query because entities managed by this spatial context have (likely) changed.

Handler parameters
NameTypeDefault
spatialContextRid—

OpenXRSpatialEntityExtension.Capability

ValueDescription
Anchor = 1000762000

Anchor capability.

MarkerTrackingAprilTag = 1000743003

April tag based marker tracking capability.

MarkerTrackingArucoMarker = 1000743002

ArUco marker based marker tracking capability.

MarkerTrackingMicroQrCode = 1000743001

Micro QR code based marker tracking capability.

MarkerTrackingQrCode = 1000743000

QR code based marker tracking capability.

PlaneTracking = 1000741000

Plane tracking capability.

OpenXRSpatialEntityExtension.ComponentType

ValueDescription
Anchor = 1000762000

Component that provides the location for an anchor. The corresponding list structure is XrSpatialComponentAnchorListEXT; the corresponding data structure is XrPosef (Added by the XR_EXT_spatial_anchor extension).

Bounded2D = 1

Component that provides the 2D bounds for a spatial entity. The corresponding list structure is XrSpatialComponentBounded2DListEXT; the corresponding data structure is XrSpatialBounded2DDataEXT.

Bounded3D = 2

Component that provides the 3D bounds for a spatial entity. The corresponding list structure is XrSpatialComponentBounded3DListEXT; the corresponding data structure is XrBoxf.

Marker = 1000743000

A component describing the marker type, ID and location. The corresponding list structure is XrSpatialComponentMarkerListEXT; the corresponding data structure is XrSpatialMarkerDataEXT (Added by the XR_EXT_spatial_marker_tracking extension).

Mesh2D = 1000741001

Component that provides a 2D mesh for a spatial entity. The corresponding list structure is XrSpatialComponentMesh2DListEXT; the corresponding data structure is XrSpatialMeshDataEXT (Added by the XR_EXT_spatial_plane_tracking extension).

Mesh3D = 4

Component that provides a 3D mesh for a spatial entity. The corresponding list structure is XrSpatialComponentMesh3DListEXT; the corresponding data structure is XrSpatialMeshDataEXT.

Parent = 3

Component that provides the XrSpatialEntityIdEXT of the parent for a spatial entity. The corresponding list structure is XrSpatialComponentParentListEXT; the corresponding data structure is XrSpatialEntityIdEXT.

Persistence = 1000763000

Component that provides the persisted UUID for a spatial entity. The corresponding list structure is XrSpatialComponentPersistenceListEXT; the corresponding data structure is XrSpatialPersistenceDataEXT(Added by theXR_EXT_spatial_persistence` extension).

PlaneAlignment = 1000741000

Component that provides the plane alignment enum for a spatial entity. The corresponding list structure is XrSpatialComponentPlaneAlignmentListEXT; the corresponding data structure is XrSpatialPlaneAlignmentEXT (Added by the XR_EXT_spatial_plane_tracking extension).

PlaneSemanticLabel = 1000741003

Component that provides a semantic label for a plane. The corresponding list structure is XrSpatialComponentPlaneSemanticLabelListEXT; the corresponding data structure is XrSpatialPlaneSemanticLabelEXT (Added by the XR_EXT_spatial_plane_tracking extension).

Polygon2D = 1000741002

Component that provides a 2D boundary polygon for a spatial entity. The corresponding list structure is XrSpatialComponentPolygon2DListEXT; the corresponding data structure is XrSpatialPolygon2DDataEXT (Added by the XR_EXT_spatial_plane_tracking extension).

OpenXRSpatialEntityExtension.TrackingState

ValueDescription
Enabled = 2

Tracking is enabled and running.

NoPermission = -2

A permission required by the tracking logic is missing.

NotActive = 0

Tracking is currently not active.

SettingUp = 1

Tracking is being set up.

SetupFailed = -1

Setup of the tracking logic failed, consult the logs for more details.

UnsupportedCapability = -3

A capability supplied when creating the spatial context for tracking is unsupported.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.