Skip to main content
Version: 3.4

struct XRPersistentAnchor

(Niantic.Lightship.AR.XRSubsystems.XRPersistentAnchor)

Overview

Describes session-relative data for an anchor.

struct XRPersistentAnchor:
ITrackable,
IEquatable< XRPersistentAnchor > {
// fields

static XRPersistentAnchor defaultValue => s_Default;
readonly TrackableId trackableId => m_Id;
readonly Pose pose => m_Pose;
readonly TrackingState trackingState => m_TrackingState;
readonly TrackingStateReason trackingStateReason => m_TrackingStateReason;
readonly XRPersistentAnchorPayload xrPersistentAnchorPayload => m_XRPersistentAnchorPayload;
readonly UInt64 timestampMs => m_timestampMs;
IntPtr nativePtr => m_XRPersistentAnchorPayload.nativePtr;

// methods

XRPersistentAnchor(
TrackableId trackableId,
Pose pose,
TrackingState trackingState,
TrackingStateReason trackingStateReason,
XRPersistentAnchorPayload xrPersistentAnchorPayload,
UInt64 timestampMs
);

XRPersistentAnchor(TrackableId trackableId);
override int GetHashCode();
bool Equals(XRPersistentAnchor other);
override bool Equals(object obj);
static bool operator == (XRPersistentAnchor lhs, XRPersistentAnchor rhs);
static bool operator != (XRPersistentAnchor lhs, XRPersistentAnchor rhs);
};

Detailed Documentation

Describes session-relative data for an anchor.

    See also:

    XRPersistentAnchor

Fields

defaultValue

static XRPersistentAnchor defaultValue => s_Default

Gets a default-initialized XRPersistentAnchor. This may be different from the zero-initialized version (for example, the pose is Pose.identity instead of zero-initialized).

trackableId

readonly TrackableId trackableId => m_Id

Get the TrackableId associated with this anchor.

pose

readonly Pose pose => m_Pose

Get the Pose, in session space, for this anchor.

trackingState

readonly TrackingState trackingState => m_TrackingState

Get the TrackingState of this anchor.

trackingStateReason

readonly TrackingStateReason trackingStateReason => m_TrackingStateReason

Get the trackingStateReason of this anchor.

xrPersistentAnchorPayload

readonly XRPersistentAnchorPayload xrPersistentAnchorPayload => m_XRPersistentAnchorPayload

The payload for this anchor

timestampMs

readonly UInt64 timestampMs => m_timestampMs

Get the timestamp in miliseconds of the latest update for this anchor. The timestamp has the same base as the frame.

nativePtr

IntPtr nativePtr => m_XRPersistentAnchorPayload.nativePtr

A native pointer associated with the anchor. The data pointed to by this pointer is implementation-specific.

Methods

XRPersistentAnchor

XRPersistentAnchor(
TrackableId trackableId,
Pose pose,
TrackingState trackingState,
TrackingStateReason trackingStateReason,
XRPersistentAnchorPayload xrPersistentAnchorPayload,
UInt64 timestampMs
)

Constructs the session-relative data for an anchor. This is typically provided by an implementation of the XRPersistentAnchor and not invoked directly.

    Parameters:

    trackableId - The TrackableId associated with this anchor.

    pose - The Pose, in session space, of the anchor.

    trackingState - The TrackingState of the anchor.

    trackingStateReason - The reason for the current tracking state.

    xrPersistentAnchorPayload - The payload associated with the anchor.

GetHashCode

override int GetHashCode()

Generates a hash suitable for use with containers like HashSet and Dictionary.

    Returns:

    A hash code generated from this object's fields.

Equals

bool Equals(XRPersistentAnchor other)

Tests for equality.

    Parameters:

    other - The other XRPersistentAnchor to compare against.

    Returns:

    True if every field in other is equal to this XRPersistentAnchor, otherwise false.

Equals

override bool Equals(object obj)

Tests for equality.

    Parameters:

    obj - The object to compare against.

    Returns:

    True if obj is of type XRPersistentAnchor and Equals(XRPersistentAnchor) also returns true; otherwise false.

operator==

static bool operator == (XRPersistentAnchor lhs, XRPersistentAnchor rhs)

Tests for equality. Same as Equals(XRPersistentAnchor).

    Parameters:

    lhs - The left-hand side of the comparison.

    rhs - The right-hand side of the comparison.

    Returns:

    True if lhs is equal to rhs, otherwise false.

operator!=

static bool operator != (XRPersistentAnchor lhs, XRPersistentAnchor rhs)

Tests for inequality. Same as ! Equals(XRPersistentAnchor).

    Parameters:

    lhs - The left-hand side of the comparison.

    rhs - The right-hand side of the comparison.

    Returns:

    True if lhs is not equal to rhs, otherwise false.