Anchor

Describes a fixed location and orientation in the real world.

Summary

Typedefs

ArAnchor typedef
struct ArAnchor_
A position in space attached to a trackable (reference type, long-lived).
ArAnchorList typedef
struct ArAnchorList_
A list of anchors (value type).

Functions

ArAnchorList_acquireItem(const ArSession *session, const ArAnchorList *anchor_list, int32_t index, ArAnchor **out_anchor)
void
Acquires a reference to an indexed entry in the list.
ArAnchorList_create(const ArSession *session, ArAnchorList **out_anchor_list)
void
Creates an anchor list object.
ArAnchorList_destroy(ArAnchorList *anchor_list)
void
Releases the memory used by an anchor list object, along with all the anchor references it holds.
ArAnchorList_getSize(const ArSession *session, const ArAnchorList *anchor_list, int32_t *out_size)
void
Retrieves the number of anchors in this list.
ArAnchor_detach(ArSession *session, ArAnchor *anchor)
void
Tells ARCore to stop tracking and forget this anchor.
ArAnchor_getPose(const ArSession *session, const ArAnchor *anchor, ArPose *out_pose)
void
Retrieves the pose of the anchor in the world coordinate space.
ArAnchor_getTrackingState(const ArSession *session, const ArAnchor *anchor, ArTrackingState *out_tracking_state)
void
Retrieves the current state of the pose of this anchor.
ArAnchor_release(ArAnchor *anchor)
void
Releases a reference to an anchor.

Typedefs

ArAnchor

struct ArAnchor_ ArAnchor

A position in space attached to a trackable (reference type, long-lived).

Create with ArSession_acquireNewAnchor() or ArHitResult_acquireNewAnchor()
Release with ArAnchor_release()

ArAnchorList

struct ArAnchorList_ ArAnchorList

A list of anchors (value type).

Allocate with ArAnchorList_create()
Release with ArAnchorList_destroy()

Functions

ArAnchorList_acquireItem

void ArAnchorList_acquireItem(
  const ArSession *session,
  const ArAnchorList *anchor_list,
  int32_t index,
  ArAnchor **out_anchor
)

Acquires a reference to an indexed entry in the list.

This call must eventually be matched with a call to ArAnchor_release().

ArAnchorList_create

void ArAnchorList_create(
  const ArSession *session,
  ArAnchorList **out_anchor_list
)

Creates an anchor list object.

ArAnchorList_destroy

void ArAnchorList_destroy(
  ArAnchorList *anchor_list
)

Releases the memory used by an anchor list object, along with all the anchor references it holds.

ArAnchorList_getSize

void ArAnchorList_getSize(
  const ArSession *session,
  const ArAnchorList *anchor_list,
  int32_t *out_size
)

Retrieves the number of anchors in this list.

ArAnchor_detach

void ArAnchor_detach(
  ArSession *session,
  ArAnchor *anchor
)

Tells ARCore to stop tracking and forget this anchor.

This call does not release the reference to the anchor - that must be done separately using ArAnchor_release().

ArAnchor_getPose

void ArAnchor_getPose(
  const ArSession *session,
  const ArAnchor *anchor,
  ArPose *out_pose
)

Retrieves the pose of the anchor in the world coordinate space.

This pose produced by this call may change each time ArSession_update() is called. This pose should only be used for rendering if ArAnchor_getTrackingState() returns AR_TRACKING_STATE_TRACKING.

Details
Parameters
session
The ARCore session.
anchor
The anchor to retrieve the pose of.
out_pose
An already-allocated ArPose object into which the pose will be stored.

ArAnchor_getTrackingState

void ArAnchor_getTrackingState(
  const ArSession *session,
  const ArAnchor *anchor,
  ArTrackingState *out_tracking_state
)

Retrieves the current state of the pose of this anchor.

ArAnchor_release

void ArAnchor_release(
  ArAnchor *anchor
)

Releases a reference to an anchor.

This does not mean that the anchor will stop tracking, as it will be obtainable from e.g. ArSession_getAllAnchors() if any other references exist.

This method may safely be called with nullptr - it will do nothing.

Send feedback about...