interface ScenePose

Known direct subclasses
BaseScenePose

The BaseScenePose implements the ScenePose interface.

Entity

Interface for a spatial Entity.

Known indirect subclasses
ActivityPanelEntity

ActivityPanelEntity creates a spatial panel for embedding an Activity in Android XR.

ActivitySpace

ActivitySpace is an Entity used to track the system-managed pose and boundary of the volume associated with a spatialized Activity.

AnchorEntity

An AnchorEntity tracks a androidx.xr.runtime.math.Pose relative to some position or surface in the "Real World." Children of this Entity will remain positioned relative to that location in the real world, for the purposes of creating Augmented Reality experiences.

BaseEntity

The BaseEntity is an implementation of Entity interface that wraps a platform entity.

GltfModelEntity

GltfModelEntity is a concrete implementation of Entity that hosts a glTF model.

GroupEntity

An Entity that contains no content, but can have an arbitrary number of children.

MainPanelEntity

Represents the main spatialized panel in a Scene.

PanelEntity

PanelEntity contains an arbitrary 2D Android View, within a spatialized XR scene.

PerceptionSpace

PerceptionSpace is an ScenePose used to track the origin of the space used by ARCore for Jetpack XR APIs.

SurfaceEntity

SurfaceEntity is an Entity that hosts a Surface, which will be texture mapped onto the Shape.


A Pose in the Scene graph, which can be transformed into a Pose relative to another ScenePose.

Summary

Nested types

A filter for which Scenes to hit test with ScenePose.hitTest.

Public functions

suspend HitTestResult?
hitTest(origin: Vector3, direction: Vector3)

Perform a hit test from the specified origin in the specified direction into the Scene.

suspend HitTestResult?
hitTest(origin: Vector3, direction: Vector3, hitTestFilter: Int)

Creates a hit test from the specified origin in the specified direction into the scene.

Vector3
transformDirectionTo(direction: Vector3, destination: ScenePose)

Transforms a direction from this ScenePose's local space to the destination ScenePose's local space.

Pose
transformPoseTo(pose: Pose, destination: ScenePose)

Returns a Pose relative to this ScenePose, transformed into a Pose relative to the destination.

Vector3
transformPositionTo(position: Vector3, destination: ScenePose)

Transforms a position from this ScenePose's local space to the destination ScenePose's local space.

Vector3
transformVectorTo(vector: Vector3, destination: ScenePose)

Transforms a vector from this ScenePose's local space to the destination ScenePose's local space.

Public properties

Pose

The current Pose relative to the activity space root.

Extension functions

ListenableFuture<HitTestResult?>
ScenePose.hitTestAsync(
    session: Session,
    origin: Vector3,
    direction: Vector3
)

Creates a HitTestResult from the specified origin in the specified direction into the scene.

ListenableFuture<HitTestResult?>
ScenePose.hitTestAsync(
    session: Session,
    origin: Vector3,
    direction: Vector3,
    hitTestFilter: Int
)

Creates a HitTestResult from the specified origin in the specified direction into the scene.

Public functions

hitTest

suspend fun hitTest(origin: Vector3, direction: Vector3): HitTestResult?

Perform a hit test from the specified origin in the specified direction into the Scene.

Parameters
origin: Vector3

The translation of the origin of the hit test relative to this ScenePose.

direction: Vector3

The direction for the hit test ray from the origin.

Returns
HitTestResult?

The HitTestResult, or null if the hit test did not find an intersection. The HitTestResult describes the location and normal of the object closest to the hit, relative to this ScenePose.

hitTest

suspend fun hitTest(origin: Vector3, direction: Vector3, hitTestFilter: Int): HitTestResult?

Creates a hit test from the specified origin in the specified direction into the scene.

Parameters
origin: Vector3

The translation of the origin of the hit test relative to this ScenePose.

direction: Vector3

The direction for the hit test ray from the origin

hitTestFilter: Int

Filter for which scenes to hit test. Hitting other scenes is only allowed for apps with the com.android.extensions.xr.ACCESS_XR_OVERLAY_SPACE permission.

Returns
HitTestResult?

The HitTestResult, or null if the hit test did not find an intersection. The HitTestResult describes the location and normal of the object closest to the hit, relative to this ScenePose.

transformDirectionTo

Added in 1.0.0-alpha12
fun transformDirectionTo(direction: Vector3, destination: ScenePose): Vector3

Transforms a direction from this ScenePose's local space to the destination ScenePose's local space. This operation ignores relative scaling; the output vector will have the same magnitude as direction.

This operation is not affected by either ScenePose's scale or position.

Parameters
direction: Vector3

The direction in this ScenePose's local coordinate space

destination: ScenePose

The ScenePose which the returned direction will be relative to.

Returns
Vector3

The direction in the destination ScenePose's local space. It will have the same magnitude as the input direction.

transformPoseTo

Added in 1.0.0-alpha12
fun transformPoseTo(pose: Pose, destination: ScenePose): Pose

Returns a Pose relative to this ScenePose, transformed into a Pose relative to the destination.

Parameters
pose: Pose

A Pose in this ScenePose's local coordinate space.

destination: ScenePose

The ScenePose which the returned Pose will be relative to.

Returns
Pose

The Pose relative to the destination ScenePose.

transformPositionTo

Added in 1.0.0-alpha12
fun transformPositionTo(position: Vector3, destination: ScenePose): Vector3

Transforms a position from this ScenePose's local space to the destination ScenePose's local space.

This operation is affected by both ScenePose's position, rotation, and scale.

Parameters
position: Vector3

The position in this ScenePose's local coordinate space

destination: ScenePose

The ScenePose which the returned position will be relative to.

Returns
Vector3

The position in the destination ScenePose's local space.

transformVectorTo

Added in 1.0.0-alpha12
fun transformVectorTo(vector: Vector3, destination: ScenePose): Vector3

Transforms a vector from this ScenePose's local space to the destination ScenePose's local space. This operation accounts for scale. The magnitude of the output vector might be different from the magnitude of the input vector.

This operation is not affected by either ScenePose's position.

Parameters
vector: Vector3

The vector in this ScenePose's local coordinate space

destination: ScenePose

The ScenePose which the returned vector will be relative to.

Returns
Vector3

The vector in the destination ScenePose's local space. The returned magnitude will be affected by destination scale.

Public properties

activitySpacePose

Added in 1.0.0-alpha12
val activitySpacePosePose

The current Pose relative to the activity space root.

Extension functions

fun ScenePose.hitTestAsync(
    session: Session,
    origin: Vector3,
    direction: Vector3
): ListenableFuture<HitTestResult?>

Creates a HitTestResult from the specified origin in the specified direction into the scene.

Parameters
session: Session

The session the ScenePose is in.

origin: Vector3

The translation of the origin of the hit test relative to this ScenePose.

direction: Vector3

The direction for the hit test ray from the origin.

Returns
ListenableFuture<HitTestResult?>

a Future containing the HitTestResult relative to the ScenePose, or null if the hit test did not find an intersection. Listeners will be called on the main thread if Runnable::run is supplied.

fun ScenePose.hitTestAsync(
    session: Session,
    origin: Vector3,
    direction: Vector3,
    hitTestFilter: Int
): ListenableFuture<HitTestResult?>

Creates a HitTestResult from the specified origin in the specified direction into the scene.

Parameters
session: Session

The session the ScenePose is in.

origin: Vector3

The translation of the origin of the hit test relative to this ScenePose.

direction: Vector3

The direction for the hit test ray from the origin

hitTestFilter: Int

Filter for which scenes to hit test. Hitting other scenes is only allowed for apps with the com.android.extensions.xr.ACCESS_XR_OVERLAY_SPACE permission.

Returns
ListenableFuture<HitTestResult?>

a Future containing the HitTestResult relative to the ScenePose, or null if the hit test did not find an intersection. Listeners will be called on the main thread if Runnable::run is supplied.