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
int ContinuousLocalizationRateSeconds;
ARLocation[] ARLocations => GetComponentsInChildren<ARLocation>(true);
bool AutoTrack => _autoTrack;
// properties
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();
override void OnBeforeStart();
virtual override void Start();
override void OnDisable();
};
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 ContinuousLocalizationEnabled = XRPersistentAnchorConfiguration.DefaultContinuousLocalizationEnabled;
bool TemporalFusionEnabled = XRPersistentAnchorConfiguration.DefaultTemporalFusionEnabled;
float CloudLocalizerMaxRequestsPerSecond = XRPersistentAnchorConfiguration.DefaultCloudLocalizerMaxRequestsPerSecond;
uint CloudLocalizationTemporalFusionWindowSize = XRPersistentAnchorConfiguration.DefaultCloudLocalizationTemporalFusionWindowSize;
bool DiagnosticsEnabled = XRPersistentAnchorConfiguration.DefaultDiagnosticsEnabled;
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
ContinuousLocalizationRateSeconds
int ContinuousLocalizationRateSeconds
Obsolete. Use CloudLocalizerMaxRequestsPerSecond instead.
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
InterpolationTimeSeconds
float InterpolationTimeSeconds
Number of seconds over which anchor interpolation occurs. Faster times will result in more noticeable movement.
.. note::
This is an experimental feature, and is subject to breaking changes or deprecation without notice
ContinuousLocalizationEnabled
bool ContinuousLocalizationEnabled
Whether to enable or disable continuous localization
.. note::
This is an experimental feature, and is subject to breaking changes or deprecation without notice
InterpolationEnabled
bool InterpolationEnabled
Whether to enable or disable interpolation
.. note::
This is an experimental feature, and is subject to breaking changes or deprecation without notice
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:
arLocation
- 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.