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

OVRLocatable Struct

Extends IOVRAnchorComponent< OVRLocatable >, IEquatable< OVRLocatable >
Represents the Pose of the anchor.
Enabling it will localize the anchor.
This component can be accessed from an OVRAnchor that supports it by calling OVRAnchor.GetComponent<T> from the anchor.
This component needs to be enabled before requesting its Pose. See IsEnabled and SetEnabledAsync
Read more about anchors generally at Spatial Anchors Overview

Public Statics

A null representation of an OVRLocatable.
Use this to compare with another component to determine whether it is null.

Properties

Whether this object represents a valid anchor component.
True if this component is enabled and no change to its enabled status is pending.
SpaceComponentType Type[Get]
ulong Handle[Get]

Member Functions

Sets the enabled status of this component.
A component must be enabled in order to access its data or do enable its functionality.This method is asynchronous. Use the returned task to track the completion of this operation. The task's value indicates whether the operation was successful.If the current enabled state matches enabled , then the returned task completes immediately with a true result. If there is already a pending change to the enabled state, the new request is queued.
Parameters
enabled
The desired state of the component.
timeout
The timeout, in seconds, for the operation. Use zero to indicate an infinite timeout.
Returns
Returns an OVRTask<bool> whose result indicates the result of the operation.
(Obsolete) Sets the enabled status of this component if it differs from the current enabled state.
This method is obsolete. Use SetEnabledAsync instead.
Parameters
enabled
The desired state of the component.
timeout
The timeout, in seconds, for the operation. Use zero to indicate an infinite timeout.
Returns
Returns an OVRTask<bool> whose result indicates the result of the operation.
Compares this component for equality with other .
Parameters
other
The other component to compare with.
Returns
True if both components belong to the same OVRAnchor, otherwise false.
Compares this component for equality with obj .
Parameters
obj
The object to compare with.
Returns
True if obj is an OVRLocatable and Equals(OVRLocatable) is true, otherwise false.
Gets a hashcode suitable for use in a Dictionary or HashSet.
Returns
A hashcode for this component.
Gets a string representation of this component.
Returns
A string representation of this component.
Tries to get the TrackingSpacePose representing the position and rotation of this anchor, treated as a scene anchor, in tracking space.
Although the request may succeed and provide a valid TrackingSpacePose, actual Position and Rotation provided may not be valid and/or tracked, see TrackingSpacePose for more information on how to use its data.Scene anchors follow a different transform from the raw OpenXR data than spatial anchors'.
Parameters
pose
The out TrackingSpacePose which will get filled in.
Returns
True if the request was successful, False otherwise.
Tries to get the TrackingSpacePose representing the position and rotation of this anchor, treated as a spatial anchor, in tracking space.
Although the request may succeed and provide a valid TrackingSpacePose, actual position and rotation provided may not be valid and/or tracked, see TrackingSpacePose for more information on how to use its data.Spatial anchors follow a different transform from the raw OpenXR data than scene anchors'.
Parameters
pose
The out TrackingSpacePose which will get filled in.
Returns
True if the request was successful, False otherwise.

Static Member Functions

Compares two components for equality.
Parameters
lhs
The component to compare with rhs .
rhs
The component to compare with lhs .
Returns
True if both components belong to the same OVRAnchor, otherwise false.
Compares two components for inequality.
Parameters
lhs
The component to compare with rhs .
rhs
The component to compare with lhs .
Returns
True if the components do not belong to the same OVRAnchor, otherwise false.
Sets a collection of transforms according to a parallel collection of anchors.
This method accepts a collection of OVRAnchor-Transform pairs and attempts to get each anchor's pose, then apply it to the corresponding Transform.A TrackingSpacePose has a position and rotation, either of which may be valid and tracked. If a component is not valid, it is ignored (not written to the corresponding Transform in anchors ). If it is valid but not tracked, it is still written to the corresponding Transform.Example usage:
class MyBehaviour : MonoBehaviour
{
    [SerializeField] OVRCameraRig _cameraRig;
    Dictionary\<OVRAnchor, Transform\> _anchors = new();
void Update()
    {
        OVRLocatable.UpdateSceneAnchorTransforms(_anchors, _cameraRig.transform, null);
    }
}
This method is similar to calling TryGetSceneAnchorPose on each OVRAnchor in anchors and applying the result to each Transform in anchors . However, it correctly handles all permutations of pose validity and is more efficient to perform as a batch operation.
Parameters
anchors
A collection of anchor-transform pairs. The pose of each OVRAnchor is used to set its corresponding Transform.
trackingSpaceToWorldSpaceTransform
(Optional) The transform to apply to each pose before setting the corresponding transform in anchors . If not null, this transform is applied to the pose, and this method then sets the world space transform. If null, no transform is applied and the local space transform is set.
trackingSpacePoses
(Optional) If not null, trackingSpacePoses is cleared and then the TrackingSpacePose of each OVRAnchor is added to it. This is an optional parameter, but may be useful information since it also tells you whether a pose is valid and tracked.
Exceptions
ArgumentNullException
Thrown if anchors is null.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon