Entity
interface Entity : ScenePose
BaseEntity |
The BaseEntity is an implementation of Entity interface that wraps a platform entity. |
ActivityPanelEntity |
ActivityPanelEntity creates a spatial panel for embedding an |
ActivitySpace |
ActivitySpace is an |
AnchorEntity |
An AnchorEntity tracks a |
GltfModelEntity |
GltfModelEntity is a concrete implementation of Entity that hosts a glTF model. |
GroupEntity |
An |
MainPanelEntity |
Represents the main spatialized panel in a |
PanelEntity |
PanelEntity contains an arbitrary 2D Android |
SurfaceEntity |
SurfaceEntity is an |
Interface for a spatial Entity. An Entity's Poses are represented as being relative to their parent. Applications create and manage Entity instances to construct spatial scenes.
Summary
Public functions |
|
|---|---|
Unit |
Sets an Entity to be a child of this Entity in the scene graph. |
Boolean |
addComponent(component: Component)Adds a Component to this Entity. |
Unit |
dispose()Disposes of any system resources held by this Entity, and transitively calls dispose() on all its children. |
open @FloatRange(from = 0.0, to = 1.0) Float |
getAlpha()Returns the alpha transparency set for this Entity. |
@FloatRange(from = 0.0, to = 1.0) Float |
Returns the alpha transparency set for this Entity, relative to given Space. |
List<Component> |
Retrieves all components attached to this Entity. |
List<T> |
<T : Component> getComponentsOfType(type: Class<T>)Retrieves all Components of the given type |
open Pose |
getPose()Returns the |
Pose |
Returns the |
open @FloatRange(from = 0.0) Float |
getScale()Returns the local scale of this Entity, not inclusive of the parent's scale. |
@FloatRange(from = 0.0) Float |
Returns the scale of this entity, relative to given space. |
Boolean |
Returns the enabled status of this Entity. |
Unit |
Remove all components from this Entity. |
Unit |
removeComponent(component: Component)Removes the given Component from this Entity. |
open Unit |
setAlpha(alpha: @FloatRange(from = 0.0, to = 1.0) Float)Sets the alpha transparency of the Entity and its children. |
Unit |
setAlpha(alpha: @FloatRange(from = 0.0, to = 1.0) Float, relativeTo: Space)Sets the alpha transparency of the Entity relative to given Space. |
Unit |
setEnabled(enabled: Boolean)Sets the local enabled state of this Entity. |
open Unit |
Sets the |
Unit |
Sets the |
open Unit |
setScale(scale: @FloatRange(from = 0.0) Float)Sets the scale of this Entity relative to its parent. |
Unit |
setScale(scale: @FloatRange(from = 0.0) Float, relativeTo: Space)Sets the scale of this Entity relative to the given Space. |
Public properties |
|
|---|---|
List<Entity> |
Provides the list of all children of this entity. |
CharSequence |
Alternate text for this Entity to be consumed by Accessibility systems. |
Entity? |
The parent of this Entity, from which this Entity will inherit most of its properties. |
Inherited functions |
||||||
|---|---|---|---|---|---|---|
|
Public functions
addChild
fun addChild(child: Entity): Unit
Sets an Entity to be a child of this Entity in the scene graph. The child Entity will inherit properties from the parent, and will be represented in the parent's coordinate space. From a User's perspective, as this Entity moves, the child Entity will move with it.
addComponent
fun addComponent(component: Component): Boolean
Adds a Component to this Entity.
| Parameters | |
|---|---|
component: Component |
the Component to be added to the Entity. |
| Returns | |
|---|---|
Boolean |
True if given Component was successfully added to the Entity. |
dispose
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.
getAlpha
open fun getAlpha(): @FloatRange(from = 0.0, to = 1.0) Float
Returns the alpha transparency set for this Entity.
This does not necessarily equal the perceived alpha of the Entity, as the Entity may have some alpha difference applied from its parent or the system.
getAlpha
fun getAlpha(relativeTo: Space = Space.PARENT): @FloatRange(from = 0.0, to = 1.0) Float
Returns the alpha transparency set for this Entity, relative to given Space.
| Parameters | |
|---|---|
relativeTo: Space = Space.PARENT |
Gets alpha relative to given Space. Default value is the parent space. |
getComponents
fun getComponents(): List<Component>
Retrieves all components attached to this Entity.
getComponentsOfType
fun <T : Component> getComponentsOfType(type: Class<T>): List<T>
Retrieves all Components of the given type T and its sub-types attached to this Entity.
| Parameters | |
|---|---|
type: Class<T> |
The type of Component to retrieve. |
| Returns | |
|---|---|
List<T> |
List |
getPose
open fun getPose(): Pose
Returns the Pose for this Entity, relative to its parent.
getPose
fun getPose(relativeTo: Space = Space.PARENT): Pose
Returns the Pose for this Entity, relative to the provided Space.
| Parameters | |
|---|---|
relativeTo: Space = Space.PARENT |
Get the Pose relative to given Space. Default value is the parent space. |
getScale
open fun getScale(): @FloatRange(from = 0.0) Float
Returns the local scale of this Entity, not inclusive of the parent's scale.
| Returns | |
|---|---|
@FloatRange(from = 0.0) Float |
Current uniform scale applied to self and children. |
getScale
fun getScale(relativeTo: Space = Space.PARENT): @FloatRange(from = 0.0) Float
Returns the scale of this entity, relative to given space.
| Parameters | |
|---|---|
relativeTo: Space = Space.PARENT |
Get the scale relative to given Space. Default value is the parent space. |
| Returns | |
|---|---|
@FloatRange(from = 0.0) Float |
Current uniform scale applied to self and children. |
isEnabled
fun isEnabled(includeParents: Boolean = true): Boolean
Returns the enabled status of this Entity.
| Parameters | |
|---|---|
includeParents: Boolean = true |
Whether to include the enabled status of parents in the returned value. |
| Returns | |
|---|---|
Boolean |
If includeParents is |
removeAllComponents
fun removeAllComponents(): Unit
Remove all components from this Entity.
removeComponent
fun removeComponent(component: Component): Unit
Removes the given Component from this Entity.
| Parameters | |
|---|---|
component: Component |
Component to be removed from this entity. |
setAlpha
open fun setAlpha(alpha: @FloatRange(from = 0.0, to = 1.0) Float): Unit
Sets the alpha transparency of the Entity and its children. Values are in the range 0, 1 with 0 being fully transparent and 1 being fully opaque.
This value will affect the rendering of this Entity's children. Children of this node will have their alpha levels multiplied by this value and any alpha of this Entity's ancestors.
setAlpha
fun setAlpha(
alpha: @FloatRange(from = 0.0, to = 1.0) Float,
relativeTo: Space = Space.PARENT
): Unit
Sets the alpha transparency of the Entity relative to given Space. Values are in the range 0, 1 with 0 being fully transparent and 1 being fully opaque.
This value will affect the rendering of this Entity's children. Children of this node will have their alpha levels multiplied by this value and any alpha of this entity's ancestors.
Usage restrictions:
-
If the provided
alphais outside the 0, 1 range, it will be clamped automatically to 0, 1.
| Parameters | |
|---|---|
alpha: @FloatRange(from = 0.0, to = 1.0) Float |
Alpha transparency level for the Entity. |
relativeTo: Space = Space.PARENT |
Sets alpha relative to given Space. Default value is the parent Space. |
setEnabled
fun setEnabled(enabled: Boolean): Unit
Sets the local enabled state of this Entity.
When false, this Entity and all descendants will not be rendered in the scene, and the Entity will not respond to input events. If an Entity's local enabled state is true, the Entity will still be considered not enabled if at least one of its ancestors is not enabled.
| Parameters | |
|---|---|
enabled: Boolean |
The new local enabled state of this Entity. |
setPose
open fun setPose(pose: Pose): Unit
Sets the Pose for this Entity, relative to its parent.
setPose
fun setPose(pose: Pose, relativeTo: Space = Space.PARENT): Unit
Sets the Pose for this Entity. The Pose given is set relative to the Space provided.
setScale
open fun setScale(scale: @FloatRange(from = 0.0) Float): Unit
Sets the scale of this Entity relative to its parent. This value will affect the rendering of this Entity's children. As the scale increases, this will uniformly stretch the content of the Entity.
| Parameters | |
|---|---|
scale: @FloatRange(from = 0.0) Float |
The uniform scale factor from the parent. |
setScale
fun setScale(scale: @FloatRange(from = 0.0) Float, relativeTo: Space = Space.PARENT): Unit
Sets the scale of this Entity relative to the given Space. This value will affect the rendering of this Entity's children. As the scale increases, this will uniformly stretch the content of the Entity.
| Parameters | |
|---|---|
scale: @FloatRange(from = 0.0) Float |
The uniform scale factor. |
relativeTo: Space = Space.PARENT |
Set the scale relative to given Space. Default value is the parent Space. |
Public properties
children
val children: List<Entity>
Provides the list of all children of this entity.
contentDescription
var contentDescription: CharSequence
Alternate text for this Entity to be consumed by Accessibility systems.
parent
var parent: Entity?
The parent of this Entity, from which this Entity will inherit most of its properties. For example, this Entity's Pose is defined in relation to the parent Entity's coordinate space, so as the parent moves, this Entity will move with it. Setting the parent to null will remove the Entity from the scene graph.