reckfellENGINE

OpenXRSpatialAnchorCapability

Implementation for handling spatial entity anchor logic.

On this page
class OpenXRSpatialAnchorCapabilityReckfellSharpInherits OpenXRExtensionWrapper

Implementation for handling spatial entity anchor logic.

This is an internal class that handles the OpenXR anchor spatial entity extension.

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

Constructors1

OpenXRSpatialAnchorCapabilityConstructor
# OpenXRSpatialAnchorCapability
C#
public OpenXRSpatialAnchorCapability();

Methods14

CreateDefaultPersistenceContextOpenXRFutureResult
# CreateDefaultPersistenceContext
C#
public OpenXRFutureResult CreateDefaultPersistenceContext(Callable userCallback = default);

Calls OpenXRSpatialAnchorCapability.CreatePersistenceContext with a configuration that likely works with the XR runtime. user_callback is called when the context is created.

Parameters
NameTypeDefault
userCallbackCallabledefault
Returns OpenXRFutureResult
CreateNewAnchor2 overloads
# CreateNewAnchor · 1/2
C#
public OpenXRAnchorTracker CreateNewAnchor(Transform3D transform, Rid spatialContext);

Creates a new anchor that will be tracked by the XR runtime. The transform should be a transform in the local space of your XROrigin3D node. If spatial_context is not specified the default will be used, this requires ProjectSettings.xr/openxr/extensions/spatial_entity/enable_builtin_anchor_detection to be set. The returned tracker will track the location in case our reference space changes. next must be a valid next object for the XrSpatialAnchorCreateInfoEXT chain.

Parameters
NameTypeDefault
transformTransform3D—
spatialContextRid—
Returns OpenXRAnchorTracker
# CreateNewAnchor · 2/2
C#
public OpenXRAnchorTracker CreateNewAnchor(Transform3D transform, Rid spatialContext = default, OpenXRStructureBase next = null);

Creates a new anchor that will be tracked by the XR runtime. The transform should be a transform in the local space of your XROrigin3D node. If spatial_context is not specified the default will be used, this requires ProjectSettings.xr/openxr/extensions/spatial_entity/enable_builtin_anchor_detection to be set. The returned tracker will track the location in case our reference space changes. next must be a valid next object for the XrSpatialAnchorCreateInfoEXT chain.

Parameters
NameTypeDefault
transformTransform3D—
spatialContextRiddefault
nextOpenXRStructureBasenull
Returns OpenXRAnchorTracker
CreatePersistenceContextOpenXRFutureResult
# CreatePersistenceContext
C#
public OpenXRFutureResult CreatePersistenceContext(OpenXRSpatialAnchorCapability.PersistenceScope scope, Callable userCallback = default);

Creates a new persistence context for storing persistent data. 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 value for this function is the Rid for our persistence context.

Parameters
NameTypeDefault
scopeOpenXRSpatialAnchorCapability.PersistenceScope—
userCallbackCallabledefault
Returns OpenXRFutureResult
DoEntityUpdatevoid
# DoEntityUpdate
C#
public void DoEntityUpdate(Rid spatialContext, Reckfell.Collections.Array<OpenXRSpatialComponentData> componentData, OpenXRStructureBase nextSnapshotCreate = null, OpenXRStructureBase nextSnapshotQuery = null);

Calls OpenXRSpatialEntityExtension.UpdateSpatialEntities and OpenXRSpatialEntityExtension.QuerySnapshot with the anchor entities associated with spatial_context. component_data are the OpenXRSpatialComponentDatas to update for this anchor capability. If next_snapshot_create is non-null, then pass this to the next parameter in OpenXRSpatialEntityExtension.UpdateSpatialEntities. If next_snapshot_query is non-null, then pass this to the next parameter in OpenXRSpatialEntityExtension.QuerySnapshot.

Parameters
NameTypeDefault
spatialContextRid—
componentDataReckfell.Collections.Array<OpenXRSpatialComponentData>—
nextSnapshotCreateOpenXRStructureBasenull
nextSnapshotQueryOpenXRStructureBasenull
FreePersistenceContextvoid
# FreePersistenceContext
C#
public void FreePersistenceContext(Rid persistenceContext);

Frees a persistence context previously created with OpenXRSpatialAnchorCapability.CreatePersistenceContext.

Parameters
NameTypeDefault
persistenceContextRid—
GetPersistenceContextHandleulong
# GetPersistenceContextHandle
C#
public ulong GetPersistenceContextHandle(Rid persistenceContext);

Returns the internal handle for this persistence context. Note: For ReckfellExtension implementations.

Parameters
NameTypeDefault
persistenceContextRid—
Returns ulong
IsPersistenceScopeSupportedbool
# IsPersistenceScopeSupported
C#
public bool IsPersistenceScopeSupported(OpenXRSpatialAnchorCapability.PersistenceScope scope);

Returns true if this persistence scope is supported by our spatial anchor capability. Note: Only valid after an OpenXR instance has been created.

Parameters
NameTypeDefault
scopeOpenXRSpatialAnchorCapability.PersistenceScope—
Returns bool
IsSpatialAnchorSupportedbool
# IsSpatialAnchorSupported
C#
public bool IsSpatialAnchorSupported();

Returns true if spatial anchors are supported by the hardware. Only returns a valid value after OpenXR has been initialized.

Returns bool
IsSpatialPersistenceSupportedbool
# IsSpatialPersistenceSupported
C#
public bool IsSpatialPersistenceSupported();

Returns true if persistent spatial anchors are supported by the hardware. Only returns a valid value after OpenXR has been initialized.

Returns bool
PersistAnchorOpenXRFutureResult
# PersistAnchor
C#
public OpenXRFutureResult PersistAnchor(OpenXRAnchorTracker anchorTracker, Rid persistenceContext = default, Callable userCallback = default);

Changes this anchor into a persistent anchor. This means its location will be stored on the device and the anchor will be restored the next time your application starts. If persistence_context is not specified the default will be used, this requires ProjectSettings.xr/openxr/extensions/spatial_entity/enable_builtin_anchor_detection to be set. 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 value for this function is a boolean which will be set to true on successful completion.

Parameters
NameTypeDefault
anchorTrackerOpenXRAnchorTracker—
persistenceContextRiddefault
userCallbackCallabledefault
Returns OpenXRFutureResult
RemoveAnchorvoid
# RemoveAnchor
C#
public void RemoveAnchor(OpenXRAnchorTracker anchorTracker);

Remove an anchor previously created with OpenXRSpatialAnchorCapability.CreateNewAnchor. If this anchor was persistent you must first call OpenXRSpatialAnchorCapability.UnpersistAnchor and await its callback.

Parameters
NameTypeDefault
anchorTrackerOpenXRAnchorTracker—
StartEntityDiscoveryOpenXRFutureResult
# StartEntityDiscovery
C#
public OpenXRFutureResult StartEntityDiscovery(Rid spatialContext, Reckfell.Collections.Array<OpenXRSpatialComponentData> componentData, OpenXRStructureBase nextSnapshotCreate = null, OpenXRStructureBase nextSnapshotQuery = null, Callable userCallback = default);

Calls OpenXRSpatialEntityExtension.DiscoverSpatialEntities and OpenXRSpatialEntityExtension.QuerySnapshot with the anchor entities associated with spatial_context. component_data are the OpenXRSpatialComponentDatas to discover for this anchor capability. If next_snapshot_create is non-null, then pass this to the next parameter in OpenXRSpatialEntityExtension.DiscoverSpatialEntities. If next_snapshot_query is non-null, then pass this to the next parameter in OpenXRSpatialEntityExtension.QuerySnapshot. user_callback, when non-null, is called with two parameters usually twice. The first parameter is the Rid of the discovery snapshot and the second parameter is a boolean where false indicates the discovery snapshot is about to be processed, and true indicates the discovery snapshot has been processed and component_data has valid data. The second call is skipped if an error was encountered. The returned OpenXRFutureResult is identical to the return from OpenXRSpatialEntityExtension.DiscoverSpatialEntities.

Parameters
NameTypeDefault
spatialContextRid—
componentDataReckfell.Collections.Array<OpenXRSpatialComponentData>—
nextSnapshotCreateOpenXRStructureBasenull
nextSnapshotQueryOpenXRStructureBasenull
userCallbackCallabledefault
Returns OpenXRFutureResult
UnpersistAnchorOpenXRFutureResult
# UnpersistAnchor
C#
public OpenXRFutureResult UnpersistAnchor(OpenXRAnchorTracker anchorTracker, Rid persistenceContext = default, Callable userCallback = default);

Removes the persistent data from this anchor. The runtime will not recreate the anchor when your application restarts. If persistence_context is not specified the default will be used, this requires ProjectSettings.xr/openxr/extensions/spatial_entity/enabled to be set. 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 value for this function is a boolean which will be set to true on successful completion.

Parameters
NameTypeDefault
anchorTrackerOpenXRAnchorTracker—
persistenceContextRiddefault
userCallbackCallabledefault
Returns OpenXRFutureResult

OpenXRSpatialAnchorCapability.PersistenceScope

ValueDescription
LocalAnchors = 1000781000

Persistence operations and data access is limited to spatial anchors, on the same device, for the same user and same app (using OpenXRSpatialAnchorCapability.PersistAnchor and OpenXRSpatialAnchorCapability.UnpersistAnchor functions)

SystemManaged = 1

Provides the application with read-only access (i.e. application cannot modify this scope) to spatial entities persisted and managed by the system. The application can use the UUID in the persistence component for this scope to correlate entities across spatial contexts and device reboots.

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.