open class PanelEntity : ScenePose, Entity

Known direct subclasses
ActivityPanelEntity

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

MainPanelEntity

Represents the main spatialized panel in a Scene.


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

Summary

Public companion functions

PanelEntity
create(
    session: Session,
    view: View,
    dimensions: FloatSize2d,
    name: String,
    pose: Pose
)

Factory method for a spatialized PanelEntity.

PanelEntity
create(
    session: Session,
    view: View,
    pixelDimensions: IntSize2d,
    name: String,
    pose: Pose
)

Factory method for a spatialized PanelEntity.

Public functions

PerceivedResolutionResult

Gets the perceived resolution of this Entity in the CameraView.

Public properties

Float

The corner radius of the PanelEntity, in meters.

Boolean

True if this panel is the MainPanelEntity, false otherwise.

FloatSize2d

The dimensions of this PanelEntity in local space, in units relative to the scale of this Entity's parent.

IntSize2d

The dimensions of this PanelEntity, in pixels, which is the resolution of the underlying surface.

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 companion functions

create

Added in 1.0.0-alpha05
fun create(
    session: Session,
    view: View,
    dimensions: FloatSize2d,
    name: String,
    pose: Pose = Pose.Identity
): PanelEntity

Factory method for a spatialized PanelEntity.

Parameters
session: Session

XR Session in which to create the PanelEntity.

view: View

View to embed in this panel entity.

dimensions: FloatSize2d

Spatialized dimensions for the underlying surface for the given view, in meters.

name: String

Name of this PanelEntity.

pose: Pose = Pose.Identity

Pose of this entity relative to its parent, default value is Identity.

Returns
PanelEntity

a PanelEntity instance.

create

Added in 1.0.0-alpha05
fun create(
    session: Session,
    view: View,
    pixelDimensions: IntSize2d,
    name: String,
    pose: Pose = Pose.Identity
): PanelEntity

Factory method for a spatialized PanelEntity.

Parameters
session: Session

XR Session in which to create the PanelEntity.

view: View

View to embed in this panel entity.

pixelDimensions: IntSize2d

Dimensions for the underlying surface for the given view, in pixels.

name: String

Name of the panel.

pose: Pose = Pose.Identity

Pose of this PanelEntity relative to its parent, default value is Identity.

Returns
PanelEntity

a PanelEntity instance.

Public functions

getPerceivedResolution

Added in 1.0.0-alpha05
fun getPerceivedResolution(): PerceivedResolutionResult

Gets the perceived resolution of this Entity in the CameraView.

This API is only intended for use in Full Space Mode and will return PerceivedResolutionResult.InvalidCameraView in Home Space Mode.

The Entity's own rotation and the camera's viewing direction are disregarded; this value represents the dimensions of the Entity on the camera view if its largest surface was facing the camera without changing the distance of the Entity to the camera.

Returns
PerceivedResolutionResult

A PerceivedResolutionResult which encapsulates the outcome: - PerceivedResolutionResult.Success containing the PixelDimensions if the calculation is successful. - PerceivedResolutionResult.EntityTooClose if the Entity is too close to the camera. - PerceivedResolutionResult.InvalidCameraView if the camera information required for the calculation is invalid or unavailable.

Throws
kotlin.IllegalStateException

if Session.config.headTracking is set to Config.HeadTrackingMode.DISABLED.

Public properties

cornerRadius

Added in 1.0.0-alpha05
var cornerRadiusFloat

The corner radius of the PanelEntity, in meters.

isMainPanelEntity

Added in 1.0.0-alpha05
val isMainPanelEntityBoolean

True if this panel is the MainPanelEntity, false otherwise.

size

Added in 1.0.0-alpha05
var sizeFloatSize2d

The dimensions of this PanelEntity in local space, in units relative to the scale of this Entity's parent.

sizeInPixels

Added in 1.0.0-alpha05
var sizeInPixelsIntSize2d

The dimensions of this PanelEntity, in pixels, which is the resolution of the underlying surface.

This API doesn't do any scale compensation to the pixel dimensions.