Skip to main content
Version: 3.6

class ARPersistentAnchor

(Niantic.Lightship.AR.PersistentAnchors.ARPersistentAnchor)

Overview

Represents a Persistent Anchor tracked by an XR device.

	class ARPersistentAnchor: ARTrackable< XRPersistentAnchor, ARPersistentAnchor > {
public:
// fields

IntPtr nativePtr => sessionRelativeData.nativePtr;
new TrackingState trackingState => trackingStateOverride ?? sessionRelativeData.trackingState;
TrackingStateReason trackingStateReason => trackingStateReasonOverride ?? sessionRelativeData.trackingStateReason;
UInt64 TimestampMs => sessionRelativeData.timestampMs;

// properties

Pose PredictedPose;

// methods

byte[] GetDataAsBytes();
void RegisterInterpolator(ARPersistentAnchorInterpolator interpolator);
void DeregisterInterpolator();
};

Detailed Documentation

Represents a Persistent Anchor tracked by an XR device.

Persistent anchors are persistent Poses in the world that are generated by processed scans, and will be in the same real world location in future sessions. By placing virtual content relative to a Persistent Anchor, it can be restored to the same real world location in a future session.

Fields

nativePtr

IntPtr nativePtr => sessionRelativeData.nativePtr

Get the native pointer associated with this ARPersistentAnchor.

The data pointed to by this pointer is implementation defined. While its lifetime is also implementation defined, it should be valid until at least the next ARSession update.

trackingState

new TrackingState trackingState => trackingStateOverride ?? sessionRelativeData.trackingState

The Persistent Anchor's current tracking state. A Persistent Anchor should only be used to display virtual content if its tracking state is Tracking or Limited. Otherwise, the pose of the Persistent Anchor is not guaranteed to be in the correct real world location

trackingStateReason

TrackingStateReason trackingStateReason => trackingStateReasonOverride ?? sessionRelativeData.trackingStateReason

The reason for the Persistent Anchor's current tracking state

TimestampMs

UInt64 TimestampMs => sessionRelativeData.timestampMs

The timestamp in miliseconds corresponding to the last predicted pose for this Persistent Anchor(PredictedPose). The timestamp is in the same base as the frame.

Properties

PredictedPose

Pose PredictedPose

The last predicted pose for this Persistent Anchor. This is used as a source of truth in case the GameObject's pose is manipulated by interpolation or other features.

Methods

GetDataAsBytes

byte[] GetDataAsBytes()

The payload for this anchor as bytes[] This is an expensive call!