Skip to main content

class ARLocationManager

(Niantic.Lightship.AR.LocationAR.ARLocationManager)

Overview

The ARLocationManager is used to track ARLocations. ARLocations tie digital content to the physical world. When you start tracking an ARLocation, and aim your phone's camera at the physical location, the digital content that you child to the ARLocation will appear in the physical world.

	class ARLocationManager: Niantic.Lightship.AR.PersistentAnchors.ARPersistentAnchorManager {
public:
// fields

ARLocation[] ARLocations => GetComponentsInChildren<ARLocation>(true);
bool AutoTrack => _autoTrack;

// properties

int MaxLocationTrackingCount;

// events

event locationTrackingStateChanged();

// methods

void SetARLocations(params ARLocation[] arLocations);
void StartTracking();
void StopTracking();
void TryUpdateTracking();

protected:
// methods

override void OnEnable();
virtual override void Start();
override void OnDisable();
};

Inherited Members

public:
// properties

float InterpolationTimeSeconds;
bool ContinuousLocalizationEnabled;
bool InterpolationEnabled;
bool TemporalFusionEnabled;
int JpegCompressionQuality;
bool TransformUpdateSmoothingEnabled;
float InitialServiceRequestIntervalSeconds;
float ContinuousServiceRequestIntervalSeconds;
bool DiagnosticsEnabled;
float DeviceMappingLocalizationRequestIntervalSeconds;
bool CloudLocalizationEnabled;
bool DeviceMappingLocalizationEnabled;
DeviceMappingType DeviceMappingType;
bool DeviceMapDownloadEnabled;

// events

event arPersistentAnchorStateChanged();
event DebugInfoUpdated();

// methods

async Task RestartSubsystemAsync();
IEnumerator RestartSubsystemAsyncCoroutine();
bool GetVpsSessionId(out string vpsSessionId);

bool TryCreateAnchor(
Pose anchorLocalPose,
out ARPersistentAnchor arPersistentAnchor
);

bool TryTrackAnchor(
ARPersistentAnchorPayload payload,
out ARPersistentAnchor arPersistentAnchor
);

void DestroyAnchor(ARPersistentAnchor arPersistentAnchor);

protected:
// fields

override string gameObjectName => "Persistent Anchor";

// methods

override GameObject GetPrefab();
override void OnEnable();
override void OnBeforeStart();
virtual void Start();
override void OnDisable();
override void OnDestroy();

override void OnTrackablesChanged(
List<ARPersistentAnchor> added,
List<ARPersistentAnchor> updated,
List<ARPersistentAnchor> removed
);

Detailed Documentation

The ARLocationManager is used to track ARLocations. ARLocations tie digital content to the physical world. When you start tracking an ARLocation, and aim your phone's camera at the physical location, the digital content that you child to the ARLocation will appear in the physical world.

Fields

ARLocations

ARLocation[] ARLocations => GetComponentsInChildren<ARLocation>(true)

Gets all of the ARLocations childed to the ARLocationManager.

AutoTrack

bool AutoTrack => _autoTrack

Whether or not to automatically start tracking the selected ARLocation. If true, the location that is currently enabled will be automatically tracked on Start.

Properties

MaxLocationTrackingCount

int MaxLocationTrackingCount

Maximum number of locations that will be tracked by StartTracking. MaxLocationTrackingCount is always 1. Future versions of ARDK may support tracking more than one location at a time, but currently only one location at a time can be tracked.

Events

locationTrackingStateChanged

event locationTrackingStateChanged()

Called when the location tracking state has changed.

Methods

SetARLocations

void SetARLocations(params ARLocation[] arLocations)

Selects the AR Locations to try to track when StartTracking() is called. At most one of these locations will actually be tracked.

    Parameters:

    arLocations - The locations to try to track.

StartTracking

void StartTracking()

Starts tracking locations specified by SetARLocations().

Currently only one location can be tracked at a time. In the future, the number of locations tracked will be limited to MaxAnchorTrackingCount.

Content authored as children of the ARLocation will be enabled once the ARLocation becomes tracked. This will create digital content in the physical world.

If no locations were specified in SetARLocations(), requests will be made to attempt to track nearby locations. In this case, up to 5 nearby locations will be targeted and the first one to successfully track will be used.

StopTracking

void StopTracking()

Stops tracking the currently tracked location. This must be called before switching to a new location.

.. note::

Anchors are destroyed asynchronously, so there needs to be a small delay after calling StopTracking() before calling StartTracking().

TryUpdateTracking

void TryUpdateTracking()

Tries to refresh the tracking of the currently tracked anchors.