AugmentedObject


class AugmentedObject : Trackable


A representation of a physical object in real space.

Augmented Objects are detected by the XR system and provide information about their pose, extents, and label.

The pose represents the position and orientation of the center point of the object.

The extents describe the size of the object, as axis-aligned half-widths.

The label is an instance of androidx.xr.runtime.AugmentedObjectCategory that describes what the object is.

Summary

Nested types

The representation of the current state of an AugmentedObject.

Public companion functions

StateFlow<Collection<AugmentedObject>>
subscribe(session: Session)

Subscribes to a flow of AugmentedObjects.

Public functions

open AnchorCreateResult

Creates an Anchor that is attached to this trackable, using the given initial pose.

Public properties

open StateFlow<AugmentedObject.State>

A StateFlow that contains the latest State of the AugmentedObject.

Public companion functions

subscribe

Added in 1.0.0-alpha06
fun subscribe(session: Session): StateFlow<Collection<AugmentedObject>>

Subscribes to a flow of AugmentedObjects.

The flow emits a new collection of AugmentedObjects whenever the underlying XR system detects new objects or updates the state of existing ones. This typically happens on each frame update of the XR system.

Parameters
session: Session

The Session to subscribe to.

Public functions

createAnchor

open fun createAnchor(pose: Pose): AnchorCreateResult

Creates an Anchor that is attached to this trackable, using the given initial pose.

Throws
kotlin.IllegalStateException

if Session.config.augmentedObjectCategories is empty.

Public properties

state

open val stateStateFlow<AugmentedObject.State>

A StateFlow that contains the latest State of the AugmentedObject.