Google. XR. ARCoreExtensions. ARAnchorManagerExtensions
Extensions to AR Foundation's ARAnchorManager class.
Summary
Public static functions |
|
---|---|
AddAnchor(this ARAnchorManager anchorManager, double latitude, double longitude, double altitude, Quaternion eunRotation)
|
Creates a new anchor at the specified geodetic location and orientation relative to the Earth.
|
AddCloudReferencePoint(this ARAnchorManager referencePointManager, ARAnchor referencePoint)
|
Deprecated.
Please use HostCloudAnchor(ARAnchor) instead. Creates a new cloud reference point using an existing local Reference Point. |
EstimateFeatureMapQualityForHosting(this ARAnchorManager anchorManager, Pose pose)
|
Estimates the quality of the visual feature points seen by ARCore in the preceding few seconds and visible from the provided camera pose .
|
HostCloudAnchor(this ARAnchorManager anchorManager, ARAnchor anchor)
|
Creates a new Cloud Anchor using an existing local ARAnchor.
|
HostCloudAnchor(this ARAnchorManager anchorManager, ARAnchor anchor, int ttlDays)
|
Creates a new Cloud Anchor with a given lifetime using an existing local ARAnchor.
|
ResolveCloudAnchorId(this ARAnchorManager anchorManager, string cloudAnchorId)
|
Creates a new local Cloud Anchor from the provided Id.
|
ResolveCloudReferenceId(this ARAnchorManager referencePointManager, string cloudReferenceId)
|
Deprecated.
Please use ResolveCloudAnchorId(string) instead. Creates a new local cloud reference point from the provided Id. |
SetAuthToken(this ARAnchorManager anchorManager, string authToken)
|
void
Set the token to use when authenticating with the ARCore Cloud Anchor service on the iOS platform.
|
Public static functions
AddAnchor
ARGeospatialAnchor AddAnchor( this ARAnchorManager anchorManager, double latitude, double longitude, double altitude, Quaternion eunRotation )
Creates a new anchor at the specified geodetic location and orientation relative to the Earth.
Latitude and longitude are defined by the WGS84 specification, and altitude values are defined by the elevation above the WGS84 ellipsoid.
Creating anchors near the north pole or south pole is not supported. If the latitude is within 0.1 degrees of the north pole or south pole (90 degrees or -90 degrees), this function will return null
.
The rotation provided by eunRotation is a rotation with respect to an east-up-north coordinate frame. An identity rotation will have the anchor oriented such that X+ points to the east, Y+ points up away from the center of the earth, and Z+ points to the north.
To create a quaternion that represents a clockwise angle theta from north around the +Y anchor frame axis, use the following formula: Quaternion.AngleAxis(180f - theta, Vector3.up);
An anchor's tracking state will be TrackingState.None while AREarthManager.EarthTrackingState is TrackingState.None. The tracking state will permanently become TrackingState.None if the configuration is set to GeospatialMode.Disabled
.
Details | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||||
Returns |
If successful, a ARGeospatialAnchor, otherwise,
null . |
AddCloudReferencePoint
ARCloudReferencePoint AddCloudReferencePoint( this ARAnchorManager referencePointManager, ARAnchor referencePoint )
Creates a new cloud reference point using an existing local Reference Point.
Deprecated. Please use HostCloudAnchor(ARAnchor) instead.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
If successful, a
ARCloudReferencePoint , otherwise null . |
EstimateFeatureMapQualityForHosting
FeatureMapQuality EstimateFeatureMapQualityForHosting( this ARAnchorManager anchorManager, Pose pose )
Estimates the quality of the visual feature points seen by ARCore in the preceding few seconds and visible from the provided camera pose .
Cloud Anchors hosted using higher feature map quality will generally result in easier and more accurately resolved ARCloudAnchor
poses. If feature map quality cannot be estimated for the given pose , a warning message "Failed to estimate feature map quality" with the error status is logged and FeatureMapQuality
.Insufficient
is returned.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
The estimated feature map quality.
|
HostCloudAnchor
ARCloudAnchor HostCloudAnchor( this ARAnchorManager anchorManager, ARAnchor anchor )
Creates a new Cloud Anchor using an existing local ARAnchor.
The sample code below illustrates how to host a Cloud Anchor.
private ARCloudAnchor _cloudAnchor; void HostCloudAnchor(Pose pose) { // Create a local anchor, you may also use another ARAnchor you already have. ARAnchor localAnchor = AnchorManager.AddAnchor(pose); // Request the Cloud Anchor. _cloudAnchor = AnchorManager.HostCloudAnchor(localAnchor); } void Update() { if (_cloudAnchor) { // Check the Cloud Anchor state. CloudAnchorState cloudAnchorState = _cloudAnchor.cloudAnchorState; if (cloudAnchorState == CloudAnchorState.Success) { myOtherGameObject.transform.SetParent(_cloudAnchor.transform, false); _cloudAnchor = null; } else if (cloudAnchorState == CloudAnchorState.TaskInProgress) { // Wait, not ready yet. } else { // An error has occurred. } } }
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
If successful, a
ARCloudAnchor , otherwise null . |
HostCloudAnchor
ARCloudAnchor HostCloudAnchor( this ARAnchorManager anchorManager, ARAnchor anchor, int ttlDays )
Creates a new Cloud Anchor with a given lifetime using an existing local ARAnchor.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Returns |
If successful, an
ARCloudAnchor , otherwise null . |
ResolveCloudAnchorId
ARCloudAnchor ResolveCloudAnchorId( this ARAnchorManager anchorManager, string cloudAnchorId )
Creates a new local Cloud Anchor from the provided Id.
The sample code below illustrates how to resolve a Cloud Anchor.
private ARCloudAnchor _cloudAnchor; void ResolveCloudAnchor(string cloudAnchorId) { // Request the Cloud Anchor. _cloudAnchor = AnchorManager.ResolveCloudAnchorId(cloudAnchorId); } void Update() { if (_cloudAnchor) { // Check the Cloud Anchor state. CloudAnchorState cloudAnchorState = _cloudAnchor.cloudAnchorState; if (cloudAnchorState == CloudAnchorState.Success) { myOtherGameObject.transform.SetParent(_cloudAnchor.transform, false); _cloudAnchor = null; } else if (cloudAnchorState == CloudAnchorState.TaskInProgress) { // Wait, not ready yet. } else { // An error has occurred. } } }
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
If successful, a
ARCloudAnchor , otherwise null . |
ResolveCloudReferenceId
ARCloudReferencePoint ResolveCloudReferenceId( this ARAnchorManager referencePointManager, string cloudReferenceId )
Creates a new local cloud reference point from the provided Id.
Deprecated. Please use ResolveCloudAnchorId(string) instead.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
If successful, a
ARCloudReferencePoint , otherwise null . |
SetAuthToken
void SetAuthToken( this ARAnchorManager anchorManager, string authToken )
Set the token to use when authenticating with the ARCore Cloud Anchor service on the iOS platform.
This should be called each time the application's token is refreshed.
Details | |||||
---|---|---|---|---|---|
Parameters |
|