Struct XRTrackedObject
Describes a tracked object detected by the XRObjectTrackingSubsystem.
Namespace: UnityEngine.XR.ARSubsystems
Syntax
public struct XRTrackedObject : ITrackable, IEquatable<XRTrackedObject>
Remarks
Tracked objects are detected based on the contents of an XRReferenceObjectLibrary which contains reference objects for which to scan. Each XRTrackedObject represents an XRReferenceObject which has been detected in the environment.
Constructors
XRTrackedObject(TrackableId, Pose, TrackingState, IntPtr, Guid)
Constructs a XRTrackedObject
Declaration
public XRTrackedObject(TrackableId trackableId, Pose pose, TrackingState trackingState, IntPtr nativePtr, Guid referenceObjectGuid)
Parameters
Type | Name | Description |
---|---|---|
TrackableId | trackableId | The TrackableId associated with this tracked object. |
Pose | pose | The |
TrackingState | trackingState | The TrackingState of the tracked object. |
IntPtr | nativePtr | A native pointer associated with this tracked object. If not |
Guid | referenceObjectGuid | The |
Properties
defaultValue
A XRTrackedObject with appropriate default values.
Declaration
public static XRTrackedObject defaultValue { get; }
Property Value
Type | Description |
---|---|
XRTrackedObject |
nativePtr
A native pointer associated with this tracked object.
Declaration
public IntPtr nativePtr { get; }
Property Value
Type | Description |
---|---|
IntPtr |
Implements
Remarks
The lifetime of this pointer is provider-specific, but should be valid at least until the next call to GetChanges(Allocator) (typically once per frame).
pose
The Pose
associated with this tracked object.
Declaration
public Pose pose { get; }
Property Value
Type | Description |
---|---|
Pose |
Implements
referenceObjectGuid
The Guid
associated with the source XRReferenceObject.
Declaration
public Guid referenceObjectGuid { get; }
Property Value
Type | Description |
---|---|
Guid |
trackableId
The TrackableId associated with this tracked object.
Declaration
public TrackableId trackableId { get; }
Property Value
Type | Description |
---|---|
TrackableId |
Implements
trackingState
The TrackingState associated with this tracked object.
Declaration
public TrackingState trackingState { get; }
Property Value
Type | Description |
---|---|
TrackingState |
Implements
Methods
Equals(Object)
Tests for equality.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The |
Returns
Type | Description |
---|---|
Boolean |
|
Overrides
Equals(XRTrackedObject)
Tests for equality.
Declaration
public bool Equals(XRTrackedObject other)
Parameters
Type | Name | Description |
---|---|---|
XRTrackedObject | other | The other XRTrackedObject to compare against. |
Returns
Type | Description |
---|---|
Boolean |
|
GetHashCode()
Generates a hash suitable for use with containers like HashSet
and Dictionary
.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A hash code generated from this object's trackableId. |
Overrides
Operators
Equality(XRTrackedObject, XRTrackedObject)
Tests for equality. Same as Equals(XRTrackedObject).
Declaration
public static bool operator ==(XRTrackedObject lhs, XRTrackedObject rhs)
Parameters
Type | Name | Description |
---|---|---|
XRTrackedObject | lhs | The left-hand side of the comparison. |
XRTrackedObject | rhs | The right-hand side of the comparison. |
Returns
Type | Description |
---|---|
Boolean |
|
Inequality(XRTrackedObject, XRTrackedObject)
Tests for inequality. Same as !
Equals(XRTrackedObject).
Declaration
public static bool operator !=(XRTrackedObject lhs, XRTrackedObject rhs)
Parameters
Type | Name | Description |
---|---|---|
XRTrackedObject | lhs | The left-hand side of the comparison. |
XRTrackedObject | rhs | The right-hand side of the comparison. |
Returns
Type | Description |
---|---|
Boolean |
|