ActivitySpace
class ActivitySpace : BaseEntity
| kotlin.Any | |||
| ↳ | androidx.xr.scenecore.BaseScenePose | ||
| ↳ | androidx.xr.scenecore.BaseEntity | ||
| ↳ | androidx.xr.scenecore.ActivitySpace |
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 |
addOnBoundsChangedListener(listener: Consumer<FloatSize3d>)Adds the given |
Unit |
addOnBoundsChangedListener(Adds the given |
Unit |
addOnSpaceUpdatedListener(listener: Runnable)Adds a listener to be called when the ActivitySpace's origin has moved or changed, typically due to an internal system event. |
Unit |
addOnSpaceUpdatedListener(executor: Executor, listener: Runnable)Adds a listener to be called when the ActivitySpace's origin has moved or changed, typically due to an internal system event. |
open Unit |
dispose()Disposes of any system resources held by this Entity, and transitively calls dispose() on all its children. |
open Pose |
Returns the pose of the |
open Float |
Returns the scale of the |
Unit |
removeOnBoundsChangedListener(listener: Consumer<FloatSize3d>)Releases the given |
Unit |
removeOnSpaceUpdatedListener(listener: Runnable)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 |
||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||
|
||||||||||||||||||||
|
Inherited properties |
||||||
|---|---|---|---|---|---|---|
|
||||||
Public functions
addOnBoundsChangedListener
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
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
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
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.
dispose
open fun dispose(): Unit
Disposes of any system resources held by this Entity, and transitively calls dispose() on all its children. Once disposed, this Entity is invalid and cannot be used again.
getPose
open fun getPose(relativeTo: Space): Pose
Returns the pose of the ActivitySpace relative to the specified coordinate space.
| Parameters | |
|---|---|
relativeTo: Space |
The coordinate space to get the pose relative to. Defaults to |
| Returns | |
|---|---|
Pose |
The current pose of the |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
if called with Space.PARENT since ActivitySpace has no parents. |
getScale
open fun getScale(relativeTo: Space): Float
Returns the scale of the ActivitySpace relative to the specified coordinate space.
| Parameters | |
|---|---|
relativeTo: Space |
The coordinate space to get the scale relative to. Defaults to |
| Returns | |
|---|---|
Float |
The current scale of the |
| Throws | |
|---|---|
kotlin.IllegalArgumentException |
if called with Space.PARENT since ActivitySpace has no parents. |
removeOnBoundsChangedListener
fun removeOnBoundsChangedListener(listener: Consumer<FloatSize3d>): Unit
Releases the given Consumer from receiving updates when the ActivitySpace's boundary changes.
All listeners are automatically removed when the ActivitySpace is disposed even if this method is not explicitly called.
| Parameters | |
|---|---|
listener: Consumer<FloatSize3d> |
The Consumer to be removed from receiving updates. |
removeOnSpaceUpdatedListener
fun removeOnSpaceUpdatedListener(listener: Runnable): Unit
Removes the previously-added listener.
All listeners are automatically removed when the ActivitySpace is disposed even if this method is not explicitly called.
Public properties
recommendedContentBoxInFullSpace
val recommendedContentBoxInFullSpace: BoundingBox
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.