Overview
Category adding Cloud Anchor functionality to GARSession.
Instance Method Summary | |
(nullable GARAnchor *) | - hostCloudAnchor:error: |
Hosts a new Cloud Anchor based on an ARAnchor . More... | |
(nullable GARAnchor *) | - hostCloudAnchor:TTLDays:error: |
This will create a new Cloud Anchor with a given lifetime in days, using the transform of the provided anchor. More... | |
(GARFeatureMapQuality) | - estimateFeatureMapQualityForHosting:error: |
Estimates the quality of the visual features seen by ARCore in the preceding few seconds and visible from the provided camera transform. More... | |
(nullable GARAnchor *) | - resolveCloudAnchorWithIdentifier:error: |
Resolves a Cloud Anchor with a given identifier. More... | |
Method Detail
- (nullable GARAnchor *) hostCloudAnchor: | (ARAnchor *) | anchor | |
error: | (NSError **) | error | |
Hosts a new Cloud Anchor based on an ARAnchor
.
The new anchor will have a cloud state of GARCloudAnchorStateTaskInProgress and its initial transform will be set to that of the passed-in anchor. However, the two transforms may differ over time.
- Parameters
-
anchor The ARAnchor
to host.error Out parameter for an NSError
. Possible errors: GARSessionErrorCodeInvalidArgument - invalid (nil
) anchor. GARSessionErrorCodeNotTracking - bad current ARTrackingState. GARSessionErrorCodeResourceExhausted - tried to create too many Cloud Anchors. GARSessionErrorCodeIllegalState - current cloud anchor mode is disabled.
- Returns
- The new GARAnchor, or
nil
if there is an error.
Extends class GARSession.
- (nullable GARAnchor *) hostCloudAnchor: | (ARAnchor *) | anchor | |
TTLDays: | (NSInteger) | TTLDays | |
error: | (NSError **) | error | |
This will create a new Cloud Anchor with a given lifetime in days, using the transform of the provided anchor.
The cloud state of the returned anchor will be set to GARCloudAnchorStateTaskInProgress and the initial transform will be set to the transform of the provided anchor. However, the returned anchor is completely independent of the original anchor, and the two transforms might diverge over time.
Hosting requires an active session for which the tracking state is ARTrackingStateNormal, as well as a working internet connection. ARCore will continue to retry silently in the background if it is unable to establish a connection to the ARCore Cloud Anchor service.
- Parameters
-
anchor The ARAnchor
with the desired transform to be used to create a hosted Cloud Anchor.TTLDays The lifetime of the anchor in days. Must be positive. The maximum allowed value is 1 if using an API Key to authenticate with the ARCore Cloud Anchor service, otherwise the maximum allowed value is 365. error Out parameter for an NSError
. Possible errors: GARSessionErrorCodeInvalidArgument - invalid (nil
) anchor or invalid TTL. GARSessionErrorCodeNotTracking - bad current ARTrackingState. GARSessionErrorCodeResourceExhausted - tried to create too many Cloud Anchors. GARSessionErrorCodeIllegalState - current cloud anchor mode is disabled.
- Returns
- The new GARAnchor, or
nil
if there is an error.
Extends class GARSession.
- (GARFeatureMapQuality) estimateFeatureMapQualityForHosting: | (simd_float4x4) | transform | |
error: | (NSError **) | error | |
Estimates the quality of the visual features seen by ARCore in the preceding few seconds and visible from the provided camera transform.
Cloud Anchors hosted using higher quality features will generally result in easier and more accurately resolved Cloud Anchor transforms.
- Parameters
-
transform The camera transform to use in estimating the quality. error Out parameter for an NSError
. Possible errors: GARSessionErrorCodeNotTracking - bad current ARTrackingState. GARSessionErrorCodeIllegalState - current cloud anchor mode is disabled.
- Returns
- The estimated quality of the visual features seen by ARCore in the preceding few seconds and visible from the provided camera transform.
Extends class GARSession.
- (nullable GARAnchor *) resolveCloudAnchorWithIdentifier: | (NSString *) | identifier | |
error: | (NSError **) | error | |
Resolves a Cloud Anchor with a given identifier.
The new anchor is immediately added to the session and returned, but without a valid transform. You don’t need to wait for a call to resolve a Cloud Anchor to complete before initiating another call. A session can be resolving up to 20 Cloud Anchors at a given time. If resolving fails, the anchor will be automatically removed from the session.
- Parameters
-
identifier The Cloud Anchor identifier for the anchor. error Out parameter for an NSError
. Possible errors: GARSessionErrorCodeInvalidArgument - invalid (nil
or empty) identifier. GARSessionErrorCodeResourceExhausted - tried to create too many Cloud Anchors. GARSessionErrorCodeIllegalState - current cloud anchor mode is disabled.
- Returns
- The new GARAnchor, or
nil
if there is an error.
Extends class GARSession.