ActivitySpace


class ActivitySpace : ScenePose, Entity


ActivitySpace is an Entity used to track the system-managed pose and boundary of the volume associated with a spatialized Activity. The Application cannot directly control this volume, but the system might update it in response to the User moving it or entering or exiting Full Space Mode.

Summary

Public functions

Unit

Adds the given Consumer as a listener to be invoked when this ActivitySpace's current boundary changes.

Unit
addOnBoundsChangedListener(
    callbackExecutor: Executor,
    listener: Consumer<FloatSize3d>
)

Adds the given Consumer as a listener to be invoked when this ActivitySpace's current boundary changes.

Unit

Adds a listener to be called when the ActivitySpace's origin has moved or changed, typically due to an internal system event.

Unit

Adds a listener to be called when the ActivitySpace's origin has moved or changed, typically due to an internal system event.

Unit

Releases the given Consumer from receiving updates when the ActivitySpace's boundary changes.

Unit

Removes the previously-added listener.

Public properties

FloatSize3d

The current bounds of this ActivitySpace.

BoundingBox

A recommended box for content to be placed in when in Full Space Mode.

Inherited functions

From androidx.xr.scenecore.Entity
open @FloatRange(from = 0.0, to = 1.0) Float

Returns the alpha transparency set for this Entity.

open Pose

Returns the Pose for this Entity, relative to its parent.

open @FloatRange(from = 0.0) Float

Returns the local scale of this Entity, not inclusive of the parent's scale.

open Unit
setAlpha(alpha: @FloatRange(from = 0.0, to = 1.0) Float)

Sets the alpha transparency of the Entity and its children.

open Unit
setPose(pose: Pose)

Sets the Pose for this Entity, relative to its parent.

open Unit
setScale(scale: @FloatRange(from = 0.0) Float)

Sets the scale of this Entity relative to its parent.

From androidx.xr.scenecore.ScenePose
abstract suspend HitTestResult
hitTest(origin: Vector3, direction: Vector3)

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

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

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

abstract Pose
transformPoseTo(pose: Pose, destination: ScenePose)

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

Inherited properties

From androidx.xr.scenecore.ScenePose
abstract Pose

The current Pose relative to the activity space root.

Public functions

addOnBoundsChangedListener

Added in 1.0.0-alpha05
fun addOnBoundsChangedListener(listener: Consumer<FloatSize3d>): Unit

Adds the given Consumer as a listener to be invoked when this ActivitySpace's current boundary changes.

Consumer.accept will be invoked on the main thread.

Parameters
listener: Consumer<FloatSize3d>

The Consumer to be invoked when this ActivitySpace's current boundary changes.

addOnBoundsChangedListener

Added in 1.0.0-alpha05
fun addOnBoundsChangedListener(
    callbackExecutor: Executor,
    listener: Consumer<FloatSize3d>
): Unit

Adds the given Consumer as a listener to be invoked when this ActivitySpace's current boundary changes.

Consumer.accept will be invoked on the given executor.

Parameters
callbackExecutor: Executor

The executor on which to invoke the listener on.

listener: Consumer<FloatSize3d>

The Consumer to be invoked when this ActivitySpace's current boundary changes.

addOnSpaceUpdatedListener

Added in 1.0.0-alpha05
fun addOnSpaceUpdatedListener(listener: Runnable): Unit

Adds a listener to be called when the ActivitySpace's origin has moved or changed, typically due to an internal system event.

When this event occurs, any ScenePose that is not a child of ActivitySpace, such as AnchorEntity and CameraView, will have a different position relative to the ActivitySpace. Therefore, this listener can be used to indicate when to invalidate any cached information about the relative difference in Pose between ActivitySpace's children and children of non-ActivitySpace ScenePoses.

The callback will be made on the SceneCore executor.

Parameters
listener: Runnable

The listener to register.

addOnSpaceUpdatedListener

Added in 1.0.0-alpha05
fun addOnSpaceUpdatedListener(executor: Executor, listener: Runnable): Unit

Adds a listener to be called when the ActivitySpace's origin has moved or changed, typically due to an internal system event.

When this event occurs, any ScenePose that is not a child of ActivitySpace, such as AnchorEntity and CameraView, will have a different position relative to the ActivitySpace. Therefore, this listener can be used to indicate when to invalidate any cached information about the relative difference in Pose between ActivitySpace's children and children of non-ActivitySpace ScenePoses.

Parameters
executor: Executor

The Executor on which to run the listener.

listener: Runnable

The listener to register.

removeOnBoundsChangedListener

Added in 1.0.0-alpha05
fun removeOnBoundsChangedListener(listener: Consumer<FloatSize3d>): Unit

Releases the given Consumer from receiving updates when the ActivitySpace's boundary changes.

Parameters
listener: Consumer<FloatSize3d>

The Consumer to be removed from receiving updates.

removeOnSpaceUpdatedListener

Added in 1.0.0-alpha05
fun removeOnSpaceUpdatedListener(listener: Runnable): Unit

Removes the previously-added listener.

Public properties

bounds

Added in 1.0.0-alpha05
val boundsFloatSize3d

The current bounds of this ActivitySpace.

recommendedContentBoxInFullSpace

Added in 1.0.0-alpha05
val recommendedContentBoxInFullSpaceBoundingBox

A recommended box for content to be placed in when in Full Space Mode.

The box is relative to the ActivitySpace's coordinate system. It is not scaled by the ActivitySpace's transform. The dimensions are always in meters. This provides a device-specific default volume that developers can use to size their content appropriately.