本文へスキップ

class ARLocationManager

(Niantic.Lightship.AR.LocationAR.ARLocationManager)

概要

ARLocationManagerは、ARLocationsを追跡するために使われます。 ARLocationsは、デジタルコンテンツと現実世界を結びつけます。 ARLocationのトラッキングを開始し、携帯電話のカメラを物理的な場所に向けると、ARLocationにチャイルドしたデジタルコンテンツが物理的な世界に現れます。

	class ARLocationManager: Niantic.Lightship.AR.PersistentAnchors.ARPersistentAnchorManager {
public:
// フィールド

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

// プロパティ

int MaxLocationTrackingCount;

// イベント

event locationTrackingStateChanged();

// メソッド

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

protected:
// メソッド

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

継承メンバー

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;

// イベント

event arPersistentAnchorStateChanged();
event DebugInfoUpdated();

// メソッド

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:
// フィールド

override string gameObjectName => "Persistent Anchor";

// メソッド

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
);

詳細なドキュメント

ARLocationManagerは、ARLocationsを追跡するために使われます。 ARLocationsは、デジタルコンテンツと現実世界を結びつけます。 ARLocationのトラッキングを開始し、携帯電話のカメラを物理的な場所に向けると、ARLocationにチャイルドしたデジタルコンテンツが物理的な世界に現れます。

フィールド

ARLocations

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

ARLocationManagerにチャイルドしているすべてのARLocationsを取得します。

AutoTrack

bool AutoTrack => _autoTrack

選択されたARLocationのトラッキングを自動的に開始するかどうかを指定します。 Trueの場合は、現在有効になっている位置情報が起動時に自動的にトラッキングされます。

プロパティ

MaxLocationTrackingCount

int MaxLocationTrackingCount

StartTrackingによって追跡されるロケーションの最大数。 MaxLocationTrackingCountは常に1です。 ARDKの将来のバージョンでは、一度に複数の場所を追跡できるようになるかもしれないが、現在追跡できるのは一度に1つの場所のみです。

イベント

locationTrackingStateChanged

event locationTrackingStateChanged()

位置情報のトラッキング状態が変化すると呼び出されます。

メソッド

SetARLocations

void SetARLocations(params ARLocation[] arLocations)

StartTracking()が呼び出されるとトラッキングを試みるARロケーションを選択します。 実際に追跡されるのは1カ所になります。

    パラメーター:

    arLocation - 追跡を試みる場所。

StartTracking

void StartTracking()

SetARLocations()で指定された場所の追跡を開始します。

現在、一度に追跡できるのは1カ所のみ。 将来的には、トラッキングされる場所の数はMaxAnchorTrackingCountに制限されます。

ARLocationの子オブジェクトとしてオーサリングされたコンテンツは、ARLocationがトラッキングされた時点で有効になります。 これで、現実世界にデジタルコンテンツが生成されます。

SetARLocations()で場所が指定されていない場合、近くの場所を追跡しようとする要求が行われる。 この場合、近くにある最大5つの場所がターゲットとなり、最初に追跡に成功した場所が使用されます。

StopTracking

void StopTracking()

現在追跡している位置情報のトラッキングを停止します。 必ず、新しい位置情報に切り替える前に呼び出す必要があります。

.. 注::

アンカーは非同期に破棄されるため、[StopTracking()](./index.mdx#StopTracking)を呼び出した後、[StartTracking()](./index.mdx#StartTracking)を呼び出すまでに少し遅延が必要です。

TryUpdateTracking

void TryUpdateTracking()

現在トラッキングされているアンカーのトラッキングをリフレッシュしようとします。