Google.XR.ARCoreExtensions.ARReferencePointManagerExtensions

Extensions to AR Foundation's ARReferencePointManager class.

Summary

Public static functions

AddCloudReferencePoint(this ARReferencePointManager referencePointManager, ARReferencePoint referencePoint)
Creates a new cloud reference point using an existing local Reference Point.
ResolveCloudReferenceId(this ARReferencePointManager referencePointManager, string cloudReferenceId)
Creates a new local cloud reference point from the provided Id.

Public static functions

AddCloudReferencePoint

ARCloudReferencePoint AddCloudReferencePoint(
  this ARReferencePointManager referencePointManager,
  ARReferencePoint referencePoint
)

Creates a new cloud reference point using an existing local Reference Point.

The sample code below illustrates how to host a cloud reference point. private ARCloudReferencePoint m_CloudReferencePoint;

void HostCloudReference(Pose pose) { // Create a local Reference Point, you may also use another // Reference Point you may already have. ARReferencePoint localReferencePoint = ReferencePointManager.AddReferencePoint(pose);

// Request the cloud reference point. m_CloudReferencePoint = ReferencePointManager.AddCloudReferencePoint(localReferencePoint); }

void Update() { if (m_CloudReferencePoint) { // Check the cloud reference point state. CloudReferenceState cloudReferenceState = m_CloudReferencePoint.cloudReferenceState; if (cloudReferenceState == CloudReferenceState.Success) { myOtherGameObject.transform.SetParent m_CloudReferencePoint.transform, false); m_CloudReferencePoint = null; } else if (cloudReferenceState == CloudReferenceState.TaskInProgress) { // Wait, not ready yet. } else { // An error has occurred. } } }

Details
Parameters
referencePointManager
The ReferencePointManager instance for extending.
referencePoint
The local ARReferencePoint to be used as the basis to host a new cloud reference point.
Returns
If successful, a ARCloudReferencePoint, otherwise null.

ResolveCloudReferenceId

ARCloudReferencePoint ResolveCloudReferenceId(
  this ARReferencePointManager referencePointManager,
  string cloudReferenceId
)

Creates a new local cloud reference point from the provided Id.

The sample code below illustrates how to resolve a cloud reference point. private ARCloudReferencePoint m_CloudReferencePoint;

void ResolveCloudReference(string cloudReferenceId) { // Request the cloud reference point. m_CloudReferencePoint = ReferencePointManager.ResolveCloudReferenceId(cloudReferenceId); }

void Update() { if (m_CloudReferencePoint) { // Check the cloud reference point state. CloudReferenceState cloudReferenceState = m_CloudReferencePoint.cloudReferenceState; if (cloudReferenceState == CloudReferenceState.Success) { myOtherGameObject.transform.SetParent m_CloudReferencePoint.transform, false); m_CloudReferencePoint = null; } else if (cloudReferenceState == CloudReferenceState.TaskInProgress) { // Wait, not ready yet. } else { // An error has occurred. } } }

Details
Parameters
referencePointManager
The ReferencePointManager instance for extending.
cloudReferenceId
String representing the cloud reference.
Returns
If successful, a ARCloudReferencePoint, otherwise null.