Struct XRAnchor
Describes session relative data for an anchor.
Namespace: UnityEngine.XR.ARSubsystems
Syntax
public struct XRAnchor : ITrackable, IEquatable<XRAnchor>
Constructors
XRAnchor(TrackableId, Pose, TrackingState, IntPtr)
Constructs the session relative data for an anchor. This is typically provided by an implementation of the XRAnchorSubsystem and not invoked directly.
Declaration
public XRAnchor(TrackableId trackableId, Pose pose, TrackingState trackingState, IntPtr nativePtr)
Parameters
| Type | Name | Description |
|---|---|---|
| TrackableId | trackableId | The TrackableId associated with this anchor. |
| Pose | pose | The |
| TrackingState | trackingState | The TrackingState of the anchor. |
| IntPtr | nativePtr | A native pointer associated with the anchor. The data pointed to by this pointer is implementation-specific. |
XRAnchor(TrackableId, Pose, TrackingState, IntPtr, Guid)
Constructs the session relative data for anchor. This is typically provided by an implementation of the XRAnchorSubsystem and not invoked directly.
Declaration
public XRAnchor(TrackableId trackableId, Pose pose, TrackingState trackingState, IntPtr nativePtr, Guid sessionId)
Parameters
| Type | Name | Description |
|---|---|---|
| TrackableId | trackableId | The TrackableId associated with this anchor. |
| Pose | pose | The |
| TrackingState | trackingState | The TrackingState of the anchor. |
| IntPtr | nativePtr | A native pointer associated with the anchor. The data pointed to by this pointer is implementation-specific. |
| Guid | sessionId | The session from which this anchor originated. |
Properties
defaultValue
Gets a default-initialized XRAnchor. This may be
different from the zero-initialized version, e.g., the pose
is Pose.identity instead of zero-initialized.
Declaration
public static readonly XRAnchor defaultValue { get; }
Property Value
| Type | Description |
|---|---|
| XRAnchor |
nativePtr
A native pointer associated with the anchor. The data pointed to by this pointer is implementation-specific.
Declaration
public readonly IntPtr nativePtr { get; }
Property Value
| Type | Description |
|---|---|
| IntPtr |
Implements
pose
Get the Pose, in session space, for this anchor.
Declaration
public readonly Pose pose { get; }
Property Value
| Type | Description |
|---|---|
| Pose |
Implements
sessionId
The id of the session from which this anchor originated.
Declaration
public readonly Guid sessionId { get; }
Property Value
| Type | Description |
|---|---|
| Guid |
trackableId
Get the TrackableId associated with this anchor.
Declaration
public readonly TrackableId trackableId { get; }
Property Value
| Type | Description |
|---|---|
| TrackableId |
Implements
trackingState
Get the TrackingState of this anchor.
Declaration
public readonly 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(XRAnchor)
Tests for equality.
Declaration
public bool Equals(XRAnchor other)
Parameters
| Type | Name | Description |
|---|---|---|
| XRAnchor | other | The other XRAnchor 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 fields. |
Overrides
Operators
Equality(XRAnchor, XRAnchor)
Tests for equality. Same as Equals(XRAnchor).
Declaration
public static bool operator ==(XRAnchor lhs, XRAnchor rhs)
Parameters
| Type | Name | Description |
|---|---|---|
| XRAnchor | lhs | The left-hand side of the comparison. |
| XRAnchor | rhs | The right-hand side of the comparison. |
Returns
| Type | Description |
|---|---|
| Boolean |
|
Inequality(XRAnchor, XRAnchor)
Tests for inequality. Same as !Equals(XRAnchor).
Declaration
public static bool operator !=(XRAnchor lhs, XRAnchor rhs)
Parameters
| Type | Name | Description |
|---|---|---|
| XRAnchor | lhs | The left-hand side of the comparison. |
| XRAnchor | rhs | The right-hand side of the comparison. |
Returns
| Type | Description |
|---|---|
| Boolean |
|