public abstract class SpaceEntity extends Entity

Known direct subclasses
ActivitySpace

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

AnchorSpace

An AnchorSpace is a SpaceEntity tracks a Pose relative to some position or surface in the "Real World." Children of this SpaceEntity will remain positioned relative to that location in the real world.


A SpaceEntity is a special Entity subtype whose position is independent of other SpaceEntity. It is parentless and its position and scale are controlled by the system. Calling setPose, setScale, or setting the Entity.parent property on a SpaceEntity will result in an UnsupportedOperationException.

Examples of SpaceEntity are ActivitySpace and AnchorSpace.

Summary

Public methods

Entity

Throws UnsupportedOperationException if called.

@NonNull Pose
getPose(@NonNull Space relativeTo)

Returns the pose of the SpaceEntity relative to the specified coordinate space.

float
getScale(@NonNull Space relativeTo)

Returns the scale of the SpaceEntity relative to the specified coordinate space.

void
setParent(Entity <unused var>)

Throws UnsupportedOperationException if called.

void
setPose(@NonNull Pose pose, @NonNull Space relativeTo)

Throws UnsupportedOperationException if called.

void
setScale(float scale, @NonNull Space relativeTo)

Throws UnsupportedOperationException if called.

Inherited methods

From androidx.xr.scenecore.BaseScenePose
@NonNull Pose

The current Pose relative to the activity space root.

HitTestResult
hitTest(@NonNull Vector3 origin, @NonNull Vector3 direction)

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

HitTestResult
hitTest(
    @NonNull Vector3 origin,
    @NonNull Vector3 direction,
    int hitTestFilter
)

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

@NonNull Vector3
transformDirectionTo(
    @NonNull Vector3 direction,
    @NonNull ScenePose destination
)

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

@NonNull Pose
transformPoseTo(@NonNull Pose pose, @NonNull ScenePose destination)

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

@NonNull Vector3
transformPositionTo(
    @NonNull Vector3 position,
    @NonNull ScenePose destination
)

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

@NonNull Vector3

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

From androidx.xr.scenecore.Entity
final void

Sets an Entity to be a child of this Entity in the scene graph.

final boolean

Adds a Component to this Entity.

final @FloatRange(from = 0.0, to = 1.0) float
getAlpha(@NonNull Space relativeTo)

Returns the alpha transparency set for this Entity, relative to given Space.

final @NonNull List<@NonNull Entity>

Provides the list of all children of this entity.

final @NonNull List<@NonNull Component>

Retrieves all components attached to this Entity.

final @NonNull List<@NonNull T>

Retrieves all Components of the given type T and its subtypes attached to this Entity.

final @NonNull CharSequence

Alternate text for this Entity to be consumed by Accessibility systems.

final boolean
isEnabled(boolean includeParents)

Returns the enabled status of this Entity.

final void

Remove all components from this Entity.

final void

Removes the given Component from this Entity.

final void
setAlpha(@FloatRange(from = 0.0, to = 1.0) float alpha)

Sets the alpha transparency of the Entity relative to the parent Space.

final void

Alternate text for this Entity to be consumed by Accessibility systems.

final void
setEnabled(boolean enabled)

Sets the local enabled state of this Entity.

Public methods

getParent

public Entity getParent()

Throws UnsupportedOperationException if called.

Note: The SpaceEntity has no parent; retrieving the parent will return null.

Throws
UnsupportedOperationException

when setting

getPose

public @NonNull Pose getPose(@NonNull Space relativeTo)

Returns the pose of the SpaceEntity relative to the specified coordinate space.

Parameters
@NonNull Space relativeTo

The coordinate space to get the pose relative to. Defaults to Space.PARENT.

Returns
@NonNull Pose

The current pose of the SpaceEntity.

Throws
IllegalArgumentException

if called with Space.PARENT since SpaceEntity has no parents.

getScale

public float getScale(@NonNull Space relativeTo)

Returns the scale of the SpaceEntity relative to the specified coordinate space.

Parameters
@NonNull Space relativeTo

The coordinate space to get the scale relative to. Defaults to Space.PARENT.

Returns
float

The current scale of the SpaceEntity.

Throws
IllegalArgumentException

if called with Space.PARENT since SpaceEntity has no parents.

setParent

public void setParent(Entity <unused var>)

Throws UnsupportedOperationException if called.

Note: The SpaceEntity has no parent; retrieving the parent will return null.

Throws
UnsupportedOperationException

when setting

setPose

public void setPose(@NonNull Pose pose, @NonNull Space relativeTo)

Throws UnsupportedOperationException if called.

Note: The pose of the SpaceEntity is managed by the system. Applications should not call this method, as any changes may be overwritten by the system.

Parameters
@NonNull Pose pose

The new pose to set.

@NonNull Space relativeTo

The space in which the pose is defined. Defaults to Space.PARENT.

Throws
UnsupportedOperationException

if called.

setScale

public void setScale(float scale, @NonNull Space relativeTo)

Throws UnsupportedOperationException if called.

Note: The scale of an SpaceEntity is managed by the system. Applications should not call this method, as any changes may be overwritten by the system.

Parameters
float scale

The new scale to set.

@NonNull Space relativeTo

The space in which the scale is defined. Defaults to Space.PARENT.

Throws
UnsupportedOperationException

if called.