Null
: readonly OVRLocatable |
A null representation of an OVRLocatable.
Use this to compare with another component to determine whether it is null.
Signature
readonly OVRLocatable Null |
IsEnabled
: bool
[Get] |
True if this component is enabled and no change to its enabled status is pending.
Signature
bool IsEnabled |
IsNull
: bool
[Get] |
Whether this object represents a valid anchor component.
Signature
bool IsNull |
Equals
(
other
)
|
Compares this component for equality with other .
Signature
bool Equals(OVRLocatable other) Parameters |
Equals
(
obj
)
|
Compares this component for equality with obj .
Signature
override bool Equals(object obj) Parameters obj: object
The object to compare with.
Returns override bool
True if obj is an OVRLocatable and Equals(OVRLocatable) is true, otherwise false.
|
GetHashCode
()
|
Gets a hashcode suitable for use in a Dictionary or HashSet.
Signature
override int GetHashCode() Returns override int
A hashcode for this component.
|
SetEnabledAsync
(
enabled
, timeout
)
|
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.
Signature
OVRTask< bool > SetEnabledAsync(bool enabled, double timeout=0) Parameters enabled: bool
The desired state of the component.
timeout: double
The timeout, in seconds, for the operation. Use zero to indicate an infinite timeout.
|
SetEnabledSafeAsync
(
enabled
, timeout
)
|
(Obsolete) Sets the enabled status of this component if it differs from the current enabled state.
This method is obsolete. Use SetEnabledAsync instead.
Signature
OVRTask< bool > SetEnabledSafeAsync(bool enabled, double timeout=0) Parameters enabled: bool
The desired state of the component.
timeout: double
The timeout, in seconds, for the operation. Use zero to indicate an infinite timeout.
|
ToString
()
|
Gets a string representation of this component.
Signature
override string ToString() Returns override string
A string representation of this component.
|
TryGetSceneAnchorPose
(
pose
)
|
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'.
Signature
bool TryGetSceneAnchorPose(out TrackingSpacePose pose) Parameters Returns bool
True if the request was successful, False otherwise.
|
TryGetSpatialAnchorPose
(
pose
)
|
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'.
Signature
bool TryGetSpatialAnchorPose(out TrackingSpacePose pose) Parameters Returns bool
True if the request was successful, False otherwise.
|
operator!=
(
lhs
, rhs
)
|
Compares two components for inequality.
Signature
static bool operator!=(OVRLocatable lhs, OVRLocatable rhs) Parameters |
operator==
(
lhs
, rhs
)
|
Compares two components for equality.
Signature
static bool operator==(OVRLocatable lhs, OVRLocatable rhs) Parameters |
UpdateSceneAnchorTransforms
(
anchors
, trackingSpaceToWorldSpaceTransform
, trackingSpacePoses
)
|
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.
Signature
static void UpdateSceneAnchorTransforms(IEnumerable< KeyValuePair< OVRAnchor, Transform > > anchors, Transform trackingSpaceToWorldSpaceTransform=null, List< TrackingSpacePose > trackingSpacePoses=null) Parameters anchors: IEnumerable< KeyValuePair< OVRAnchor, Transform > >
A collection of anchor-transform pairs. The pose of each OVRAnchor is used to set its corresponding Transform.
trackingSpaceToWorldSpaceTransform: Transform
(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: List< TrackingSpacePose >
(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.
Returns voidThrows ArgumentNullException
Thrown if anchors is null.
|
true), in which case the TrackingSpacePose.Position and TrackingSpacePose.Rotation properties corresponding to this OVRLocatable will be null.
Locatables
: NativeArray< OVRLocatable > |
The array of locatable components from which to read the anchor's pose.
This array must have the same length as Poses.
Signature
NativeArray<OVRLocatable> Locatables |
Poses
: NativeArray< TrackingSpacePose > |
The array of TrackingSpacePoses in which to store the resulting pose.
This array must have the same length as Locatables.
Signature
NativeArray<TrackingSpacePose> Poses |
Execute
(
index
)
|
Signature
void IJobFor. Execute(int index) Parameters index: intReturns void IJobFor. |
true), in which case the TrackingSpacePose.Position and TrackingSpacePose.Rotation properties corresponding to this OVRLocatable will be null.
Locatables
: NativeArray< OVRLocatable > |
The array of locatable components from which to read the anchor's pose.
This array must have the same length as Poses.
Signature
NativeArray<OVRLocatable> Locatables |
Poses
: NativeArray< TrackingSpacePose > |
The array of TrackingSpacePoses in which to store the resulting pose.
This array must have the same length as Locatables.
Signature
NativeArray<TrackingSpacePose> Poses |
Execute
(
index
)
|
Signature
void IJobFor. Execute(int index) Parameters index: intReturns void IJobFor. |
UnityEngine.Transform described by a TransformAccessArray.
Poses
: NativeArray< TrackingSpacePose > |
Signature
NativeArray<TrackingSpacePose> Poses |
Execute
(
index
, transform
)
|
Signature
void Execute(int index, TransformAccess transform) Parameters index: inttransform: TransformAccessReturns void |
UnityEngine.Transform described by a TransformAccessArray.
Poses
: NativeArray< TrackingSpacePose > |
The array of poses to apply to each element of the TransformAccessArray.
Signature
NativeArray<TrackingSpacePose> Poses |
Execute
(
index
, transform
)
|
Signature
void IJobParallelForTransform. Execute(int index, TransformAccess transform) Parameters index: inttransform: TransformAccessReturns void IJobParallelForTransform. |
IsPositionTracked
: bool
[Get] |
Indicates whether the position is currently tracked.
Signature
bool IsPositionTracked |
IsRotationTracked
: bool
[Get] |
Indicates whether the rotation is currently tracked.
Signature
bool IsRotationTracked |
Position
: Vector3?
[Get] |
Position in tracking space of the anchor.
Null if and when the rotation is invalid. This constitutes the positional aspect of the anchor's pose. See Rotation for the rotational part.
Signature
Vector3? Position |
Rotation
: Quaternion?
[Get] |
Rotation in tracking space of the anchor.
Null if and when the rotation is invalid. This constitutes the rotational aspect of the anchor's pose. See Position for the positional part.
Signature
Quaternion? Rotation |
ComputeWorldPosition
(
camera
)
|
DeprecatedComputes the world space position of the anchor
Signature
Vector3? ComputeWorldPosition(Camera camera) Parameters camera: Camera
A Camera component that will be use to compute the transform to world space
Returns Vector3?
Returns the nullable Vector3 position in world space which may be null if and when Position is invalid or head pose is invalid.
Throws ArgumentNullException
If camera is null
|
ComputeWorldPosition
(
trackingSpaceToWorldSpaceTransform
)
|
Computes the world-space position of the anchor.
Signature
Vector3? ComputeWorldPosition(Transform trackingSpaceToWorldSpaceTransform) Parameters trackingSpaceToWorldSpaceTransform: Transform
Uses this transform to convert position from tracking-space to world-space.
Returns Vector3?
The world-space position of the anchor, or null if Position does not have a value.
|
ComputeWorldRotation
(
camera
)
|
DeprecatedComputes the world space rotation of the anchor
Signature
Quaternion? ComputeWorldRotation(Camera camera) Parameters camera: Camera
A Camera component that will be use to compute the transform to world space
Returns Quaternion?
The nullable Quaternion rotation in world space which may be null if and when Rotation is invalid or if head rotation is invalid.
Throws ArgumentNullException
If camera is null
|
ComputeWorldRotation
(
trackingSpaceToWorldSpaceTransform
)
|
Computes the world-space rotation of the anchor.
Signature
Quaternion? ComputeWorldRotation(Transform trackingSpaceToWorldSpaceTransform) Parameters trackingSpaceToWorldSpaceTransform: Transform
Uses this transform to convert rotation from tracking-space to world-space.
Returns Quaternion?
The world-space rotation of the anchor, or null if Rotation does not have a value.
|
void TransformPoses(NativeArray<TrackingSpacePose> poses, Transform transform)
{
var jobHandle = new TransformPosesJob
{
Poses = poses,
Transform = transform.localToWorldMatrix,
Rotation = transform.rotation,
}.Schedule(poses.Length);
}Poses
: NativeArray< TrackingSpacePose > |
The poses to transform.
Signature
NativeArray<TrackingSpacePose> Poses |
Rotation
: Quaternion |
The rotation to apply to each TrackingSpacePose rotation in Poses.
Typically, this should be the rotational component of Transform. It is separate because the rotation is not guaranteed to be extracted from a Matrix4x4 if, for example, it has non-uniform scale.
Signature
Quaternion Rotation |
Transform
: Matrix4x4 |
The transform to apply to each TrackingSpacePose position in Poses.
Signature
Matrix4x4 Transform |
Execute
(
index
)
|
Signature
void IJobFor. Execute(int index) Parameters index: intReturns void IJobFor. |