API reference
API reference
Select your platform
No SDKs available
No versions available

OVRAnchor Struct

Extends IEquatable< OVRAnchor >, IDisposable
Represents an anchor.
Scenes anchors are uniquely identified with their Uuid.
You may dispose of an anchor by calling their Dispose method.

Member Enumerations

Enumeration SaveResult

Success
The operation succeeded.
Failure
The operation failed.
FailureInvalidAnchor
At least one anchor is invalid.
FailureDataIsInvalid
Invalid data.
FailureInsufficientResources
Resource limitation prevented this operation from executing.
FailureStorageAtCapacity
Operation could not be completed until resources used are reduced or storage expanded.
FailureInsufficientView
Insufficient view.
FailurePermissionInsufficient
Insufficient permission.
FailureRateLimited
Operation canceled due to rate limiting.
FailureTooDark
Too dark.
FailureTooBright
Too bright.
FailureUnsupported
Save is not supported.
FailurePersistenceNotEnabled
Persistence not enabled.

Enumeration EraseResult

Success
The operation succeeded.
Failure
The operation failed.
FailureInvalidAnchor
At least one anchor is invalid.
FailureDataIsInvalid
Invalid data.
FailureInsufficientResources
Resource limitation prevented this operation from executing.
FailurePermissionInsufficient
Insufficient permission.
FailureRateLimited
Operation canceled due to rate limiting.
FailureUnsupported
Erase is not supported.
FailurePersistenceNotEnabled
Persistence not enabled.

Enumeration FetchResult

Success
The operation succeeded.
Failure
The operation failed.
FailureDataIsInvalid
Invalid data.
FailureInvalidOption
One of the FetchOptions was invalid.
FailureInsufficientResources
Resource limitation prevented this operation from executing.
FailureInsufficientView
Insufficient view.
FailurePermissionInsufficient
Insufficient permission.
FailureRateLimited
Operation canceled due to rate limiting.
FailureTooDark
Too dark.
FailureTooBright
Too bright.
FailureUnsupported
Fetch is not supported.

Enumeration ShareResult

Success
The operation succeeded.
Failure
The operation failed.
FailureHandleInvalid
Invalid handle.
FailureDataIsInvalid
Invalid data.
FailureNetworkTimeout
A network timeout occurred.
FailureNetworkRequestFailed
Network request failed.
FailureMappingInsufficient
The device has not built a sufficient map of the environment to share the anchor(s).
FailureLocalizationFailed
The device was not able to localize the anchor(s) being shared.
FailureSharableComponentNotEnabled
Sharable component not enabled on the anchor(s) being shared.
FailureCloudStorageDisabled
Sharing failed because device has not enabled the Share Point Cloud Data setting.
FailureUnsupported
Anchor Sharing is not supported.

Public Statics

static readonly OVRAnchor Null[Get]
static readonly Dictionary< DeferredKey, List< DeferredValue > > _deferredTasks[Get]

Properties

ulong Handle[Get]
Unique Identifier representing the anchor.

Static Member Functions

Fetch anchors matching a query.
This method queries for anchors that match the corresponding options . This method is asynchronous; use the returned OVRTask<TResult> to check for completion.Anchors may be returned in batches. If incrementalResultsCallback is not null, then this delegate is invoked whenever results become available prior to the completion of the entire operation. New anchors are appended to anchors . The delegate receives a reference to anchors and the starting index of the anchors that have been added. The parameters are:
  • anchors: The same List provided by anchors .
  • index: The starting index of the newly available anchors
Parameters
anchors
Container to store the results. The list is cleared before adding any anchors.
options
Options describing which anchors to fetch.
incrementalResultsCallback
(Optional) A callback invoked when incremental results are available.
Returns
An OVRTask<TResult> that can be used to track the asynchronous fetch.
Exceptions
ArgumentNullException
Thrown if anchors is null.
Creates a new spatial anchor.
Spatial anchor creation is asynchronous. This method initiates a request to create a spatial anchor at trackingSpacePose . The returned OVRTask<TResult> can be awaited or used to track the completion of the request.If spatial anchor creation fails, the resulting OVRAnchor will be OVRAnchor.Null.
Parameters
trackingSpacePose
The pose, in tracking space, at which you wish to create the spatial anchor.
Returns
A task which can be used to track completion of the request.
Creates a new spatial anchor.
Spatial anchor creation is asynchronous. This method initiates a request to create a spatial anchor at transform . The returned OVRTask<TResult> can be awaited or used to track the completion of the request.If spatial anchor creation fails, the resulting OVRAnchor will be OVRAnchor.Null.
Parameters
transform
The transform at which you wish to create the spatial anchor.
centerEyeCamera
The Camera associated with the Meta Quest's center eye.
Returns
A task which can be used to track completion of the request.
Exceptions
ArgumentNullException
Thrown when transform is null.
ArgumentNullException
Thrown when centerEyeCamera is null.
Save a collection of anchors.
This method persists up to 32 anchors so that they may be retrieved later.This operation is asynchronous. Use the returned OVRTask<TResult> to track the result of the asynchronous operation.
Parameters
anchors
A collection of anchors to persist.
Returns
An awaitable OVRTask<TResult> representing the asynchronous request.
Exceptions
ArgumentException
Thrown if anchors contains more than 32 anchors.
Erase a collection of anchors.
This method removes up to 32 anchors from persistent storage.This operation is asynchronous. Use the returned OVRTask<TResult> to track the result of the asynchronous operation.
Parameters
anchors
(Optional) A collection of anchors to remove from persistent storage.
uuids
(Optional) A collection of uuids to remove from persistent storage.
Returns
An awaitable OVRTask<TResult> representing the asynchronous request.
Exceptions
ArgumentException
Thrown if both anchors and uuids are null.
Exceptions
ArgumentException
Thrown if the combined number of anchors and uuids is greater than 32.
static unsafe OVRTask< OVRResult< EraseResult > > EraseSpacesAsync
( int spaceCount,
ulong * spaces,
int uuidCount,
Guid * uuids )
Share a collection of anchors with a collection of users.
This method shares a collection of anchors with a collection of users.This operation is asynchronous. Use the returned OVRTask<TResult> to track the result of the asynchronous operation.
Parameters
anchors
A collection of anchors to share.
users
A collection of users with whom anchors will be shared.
Returns
An awaitable OVRTask<TResult> representing the asynchronous request.
Exceptions
ArgumentNullException
Thrown if anchors or users are null.
ArgumentException
Thrown if users count is less than one.
static unsafe OVRTask< OVRResult< ShareResult > > ShareSpacesAsync
( int spaceCount,
ulong * spaces,
int userCount,
ulong * users )
static bool operator==
( OVRAnchor lhs,
OVRAnchor rhs )
static bool operator!=
( OVRAnchor lhs,
OVRAnchor rhs )
(Obsolete) Asynchronous method that fetches anchors with a specific component.
Dispose of the returned OVRTask<T> if you don't use the results
Others
T
The type of component the fetched anchor must have.
Parameters
anchors
IList that will get cleared and populated with the requested anchors.
s
Parameters
location
Storage location to query
maxResults
The maximum number of results the query can return
timeout
Timeout in seconds for the query.
Deprecated
Returns
An OVRTask<T> that will eventually let you test if the fetch was successful or not. If the result is true, then the anchors parameter has been populated with the requested anchors.
Exceptions
System.ArgumentNullException
Thrown if anchors is null.
(Obsolete) Asynchronous method that fetches anchors with specifics uuids.
Parameters
uuids
Enumerable of uuids that anchors fetched must verify
anchors
IList that will get cleared and populated with the requested anchors.
s
Parameters
location
Storage location to query
timeout
Timeout in seconds for the query.
Dispose of the returned OVRTask<T> if you don't use the results Deprecated
Returns
An OVRTask<T> that will eventually let you test if the fetch was successful or not. If the result is true, then the anchors parameter has been populated with the requested anchors.
Exceptions
System.ArgumentNullException
Thrown if uuids is null.
System.ArgumentNullException
Thrown if anchors is null.

Member Functions

Save this anchor.
This method persists the anchor so that it may be retrieved later, e.g., by using FetchAnchorsAsync(List<OVRAnchor>,FetchOptions,Action<List<OVRAnchor>,int>).This operation is asynchronous. Use the returned OVRTask<TResult> to track the result of the asynchronous operation.NOTE: When saving multiple anchors, it is more efficient to save them in a batch using SaveAsync(IEnumerable<OVRAnchor>).
Returns
An awaitable OVRTask<TResult> representing the asynchronous request.
Erases this anchor.
This method removes the anchor from persistent storage. Note this does not destroy the current instance.This operation is asynchronous. Use the returned OVRTask<TResult> to track the result of the asynchronous operation.NOTE: When erasing multiple anchors, it is more efficient to erase them in a batch using EraseAsync(IEnumerable<OVRAnchor>,IEnumerable<Guid>).
Returns
An awaitable OVRTask<TResult> representing the asynchronous request.
Share this anchor with the specified users.
This method shares the anchor with a collection of OVRSpaceUser.This operation is asynchronous. Use the returned OVRTask<TResult> to track the result of the asynchronous operation.
Parameters
users
A collection of users with whom anchors will be shared.
Returns
An awaitable OVRTask<TResult> representing the asynchronous request.
Exceptions
ArgumentNullException
Thrown if users is null.
ArgumentException
Thrown if users count is less than one.
See Also
ShareAsync(IEnumerable<OVRAnchor>)
Gets the anchor's component of a specific type.
Make sure the anchor supports the specified type of component using SupportsComponent<T>
Others
T
The type of the component.
Returns
The requested component.
Exceptions
InvalidOperationException
Thrown if the anchor doesn't support the specified type of component.
Tries to get the anchor's component of a specific type.
Parameters
component
The requested component, as an out parameter.
Others
T
The type of the component.
Returns
Whether or not the request succeeded. It may fail if the anchor doesn't support this type of component.
Tests whether or not the anchor supports a specific type of component.
For performance reasons, we use xrGetSpaceComponentStatusFB, which can result in an error in the logs when the component is not available.This error does not have impact on the control flow. The alternative method, avoids this error reporting, but does have performance constraints.
Others
T
The type of the component.
Returns
Whether or not the specified type of component is supported.
Get all the supported components of an anchor.
Parameters
components
The list to populate with the supported components. The list is cleared first.
Returns
True if the supported components could be retrieved, otherwise False.
bool Equals
( OVRAnchor other )
override bool Equals
( object obj )
override int GetHashCode ( )
override string ToString ( )
Disposes of an anchor.
Calling this method will destroy the anchor so that it won't be managed by internal systems until the next time it is fetched again.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon