Anchor

public class Anchor

Describes a fixed location and orientation in the real world. To stay at a fixed location in physical space, the numerical description of this position will update as ARCore's understanding of the space improves.

Use getPose() to get the current numerical location of this anchor. This location may change any time Session.update() is called, but will never spontaneously change.

mathematically:
point_world = anchor.getPose().transformPoint(point_local);
point_world = anchor.getPose().toMatrix() * point_local;

anchor.getPose().toMatrix(...) provides a matrix appropriate for composing with the view and projection matrices when rendering an object at this anchor's location.

Anchors are hashable and may for example be used as keys in HashMaps.

Anchors incur ongoing processing overhead within ARCore. To release unneeded anchors use detach().

Nested Classes

enum Anchor.CloudAnchorState Result of a Cloud Anchor hosting or resolving operation. 
enum Anchor.RooftopAnchorState Describes the Rooftop anchor state of asynchronous operation launched by Earth.resolveAnchorOnRooftopAsync(double, double, double, float, float, float, float, BiConsumer)
enum Anchor.TerrainAnchorState Describes the result of a Terrain anchor operation. 

Public Methods

void
detach()
Detaches this Anchor from its Trackable removes it from the Session.
boolean
equals(Object obj)
Indicates whether some other object is an Anchor referencing the same logical anchor as this one.
String
getCloudAnchorId()
This method is deprecated. For cloud anchors hosted by the async method Session.hostCloudAnchorAsync(Anchor, int, BiConsumer), the result Cloud Anchor ID can be obtained from the corresponding callback or Future object. This method will always return the empty string for anchors created through async methods.
Anchor.CloudAnchorState
getCloudAnchorState()
This method is deprecated. For Cloud Anchor operations created by the async Cloud Anchor methods, the result state can be obtained from the corresponding callback or Future object. This method will always return Anchor.CloudAnchorState.NONE for anchors created through async methods.
Pose
getPose()
Returns the pose of the anchor in the world coordinate space.
Anchor.TerrainAnchorState
getTerrainAnchorState()
This method is deprecated. For resolve operations created by the async method Earth.resolveAnchorOnTerrainAsync(double, double, double, float, float, float, float, BiConsumer), the result state can be obtained for the callback or future object.
TrackingState
getTrackingState()
Returns the current state of the pose of this anchor.
int
hashCode()
Returns a hash code value for the object.

Inherited Methods

Public Methods