Skip to main content
Version: 3.0

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

float ContinuousLocalizationRateSeconds;
float InterpolationTimeSeconds;
bool ContinuousLocalizationEnabled;
bool InterpolationEnabled;
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();
override void Update();
};

Inherited Members

public:
// events

event arPersistentAnchorStateChanged();

// methods

bool GetVpsSessionId(out string vpsSessionId);

bool TryTrackAnchor(
ARPersistentAnchorPayload payload,
out ARPersistentAnchor arPersistentAnchor
);

void DestroyAnchor(ARPersistentAnchor arPersistentAnchor);

protected:
// fields

bool InterpolateAnchors = false;
bool TemporalFusionEnabled = false;
override string gameObjectName => "Persistent Anchor";

// methods

override GameObject GetPrefab();
override void OnEnable();
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

Maximun number of locations that will be tracked by StartTracking. We only support MaxLocationTrackingCount = 1 at the moment

Events

locationTrackingStateChanged

event locationTrackingStateChanged()

Called when the location tracking state has changed.

Methods

SetARLocations

void SetARLocations(params ARLocation[] arLocations)

Selects what AR Locations to track when StartTracking() is called

    Parameters:

    arLocation - The locations to track.

StartTracking

void StartTracking()

Starts tracking locations specified by SetARLocations(). The number of locations tracked will be limited to MaxAnchorTrackingCount The location(s) that ends up being tracked up to MaxAnchorTrackingCount are in first-come first-serve order. This will create digital content in the physical world. Content authored as children of the ARLocation will be enabled once the ARLocation becomes tracked. If no locations were specified in SetARLocations(), the closest five locations for the area will be selected

StopTracking

void StopTracking()

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

TryUpdateTracking

void TryUpdateTracking()

Tries to refresh the tracking of the currently tracked anchors.