API reference
API reference
Select your platform
No SDKs available
No versions available

PanelSceneObject Class

Extends SceneObject
Modifiers: final
PanelSceneObject combines several components to create an interactive 2D surface in 3D space in the following order:
  1. A PanelSurface that holds the pixels of the panel
  2. A PanelDisplay that renders content on the surface
  3. A PanelInputListener that handles input events
  4. A PanelShape that defines the geometry (quad, cylinder, etc.)
Example: Retrieving a PanelSceneObject from an entity using SceneObjectSystem
// Get the SceneObject associated with the entity (returns a CompletableFuture)
systemManager.findSystem<SceneObjectSystem>().getSceneObject(entity)?.thenAccept { sceneObject ->
    if (sceneObject is PanelSceneObject) {
        // Now you can work with the panel
    }
}

Signature

class PanelSceneObject : SceneObject

Constructors

PanelSceneObject ( scene , ctx , intent , ent , config , displayCreator )
Parameters
scene: Scene?
intent: Intent
ent: Entity?
displayCreator: Function4
PanelSceneObject ( scene , ctx , id , ent , config , displayCreator )
Parameters
scene: Scene?
id: Class?
ent: Entity?
displayCreator: Function4
PanelSceneObject ( scene , ctx , ent , config , getView , displayCreator )
Parameters
scene: Scene?
ent: Entity?
getView: Function1
displayCreator: Function4
PanelSceneObject ( scene , ctx , id , ent , config , displayCreator )
Parameters
scene: Scene?
id: Int
ent: Entity?
displayCreator: Function4
PanelSceneObject ( scene , ent , config )
Signature
constructor(scene: Scene?, ent: Entity?, config: PanelConfigOptions = PanelConfigOptions())
Parameters
scene: Scene?
ent: Entity?

Properties

display : PanelDisplay?
[Get]
Gets the PanelDisplay associated with this panel, or null if no display is attached. Most commonly display is null for Direct-To-Surface rendered panels.
Signature
val display: PanelDisplay?
entity : Entity?
[Get]
Signature
val entity: Entity?
handle : Long
[Get]
Signature
var handle: Long
layer : SceneLayer?
[Get]
Gets the layer used by this panel.
Signature
val layer: SceneLayer?
materials : List?
[Get]
Read-only list of SceneMaterials created from this SceneObject's mesh property.
You can read materials from this list and modify their properties (e.g., colors, textures), but you cannot replace a material at a specific index with a different material object. Changes to material properties will be unique to this SceneObject, but these materials will inherit any changes made in the SceneMesh they come from.
Materials are lazily populated on first access. This triggers material instance creation and marks the entity as dirty for rendering. If you don't need to customize materials, avoid accessing this property to improve performance.
Example usage:
// ✅ Allowed: Read and modify material properties
sceneObject.materials?.get(0)?.setColor(Color4(1f, 0f, 0f, 1f))
sceneObject.materials?.getOrNull(1)?.setTexture("albedo", myTexture)
sceneObject.materials?.forEach { it.setRoughness(0.5f) }
// ❌ Not allowed: Replace material at index (compile error)
// sceneObject.materials?.set(0, differentMaterial) // Compile error - List is immutable
// sceneObject.materials[0] = differentMaterial // Compile error - no set operator

Signature
val materials: List<SceneMaterial>?
mesh : SceneMesh?
[Get][Set]
Reference to the SceneMesh used by this SceneObject. This property is a reference to the underlying mesh resource. Changes to the SceneMesh or its SceneMaterials will be reflected across all SceneObjects that reference it.
Signature
var mesh: SceneMesh?
panelShapeConfig : PanelShapeConfig?
[Get]
Gets the config used to create this panel.
Signature
val panelShapeConfig: PanelShapeConfig?
rootView : View?
[Get]
Gets the root View of the panel's display.
Signature
val rootView: View
shapeType : PanelShapeType
[Get]
Signature
val PanelSceneObject.shapeType: PanelShapeType
surface : Surface
[Get]
Gets the Surface associated with this panel.
Signature
val surface: Surface
swapchain : SceneSwapchain?
[Get]
Gets the SceneSwapchain associated with this panel.
Signature
val swapchain: SceneSwapchain?
texture : SceneTexture?
[Get]
Gets the texture used by this panel.
Signature
val texture: SceneTexture?

Functions

addInputListener ( listener )
Add an input listener to this SceneObject.
Signature
fun addInputListener(listener: InputListener): Long
Parameters
listener: InputListener
  The input listener to add.
Returns
Long
  The id of the input listener.
attachDisplay ( ctxt , clickButtons , displayCreator )
Signature
fun attachDisplay(ctxt: SpatialContext, clickButtons: Int, displayCreator: (PanelSurface) -> PanelDisplay)
Parameters
clickButtons: Int
displayCreator: Function1
createIsdkComponents ( entity )
Creates the IsdkPanelDimensions and IsdkCurvedPanel components for the given entity, if they do not already exist. This method also updates the properties of these components from the PanelSceneObject properties.
This method is normally invoked by the IsdkComponentCreationSystem - you will only need to call this method directly if IsdkSystem is disabled.
Signature
fun PanelSceneObject.createIsdkComponents(entity: Entity)
Parameters
entity: Entity
destroy ()
Destory this SceneObject.
Signature
fun destroy()
destroyInternal ()
Destroy this SceneObject's native components.
Signature
open override fun destroyInternal()
detachDisplay ()
Signature
fun detachDisplay()
getDisplay ()
DeprecatedUse property 'display' instead
Gets the PanelDisplay associated with this panel.
Signature
fun getDisplay(): PanelDisplay
Returns
  The PanelDisplay object
Throws
IllegalStateException
  if no display is attached
getLayer ()
DeprecatedUse property 'layer' instead
Gets the layer used by this panel.
Signature
fun getLayer(): SceneLayer?
Returns
  The SceneLayer object or null if no layer is used
getPanelShapeConfig ()
DeprecatedUse property 'panelShapeConfig' instead
Gets the config used used to create this panel.
Signature
fun getPanelShapeConfig(): PanelShapeConfig?
Returns
  The PanelShapeConfig object or null if it was not used.
getSurface ()
DeprecatedUse property 'surface' instead
Gets the Surface associated with this panel.
Signature
fun getSurface(): Surface
Returns
Surface
  The Surface object
getSwapchain ()
DeprecatedUse property 'swapchain' instead
Gets the SceneSwapchain associated with this panel.
Signature
fun getSwapchain(): SceneSwapchain?
Returns
  The SceneSwapchain object or null if Layers is not enabled.
getTexture ()
DeprecatedUse property 'texture' instead
Gets the texture used by this panel.
Signature
fun getTexture(): SceneTexture?
Returns
  The SceneTexture object or null if no texture is used
onClick ( hitInfo , sourceOfInput )
Handler for clicks on this SceneObject.
Signature
open fun onClick(hitInfo: HitInfo, sourceOfInput: Entity)
Parameters
hitInfo: HitInfo
  The HitInfo object containing information about the hit.
sourceOfInput: Entity
  The entity that generated the pointer event.
onClickDown ( hitInfo , sourceOfInput )
Handler for click downs on this SceneObject. Use onClick() to ensure user releases the click on the SceneObject.
Signature
fun onClickDown(hitInfo: HitInfo, sourceOfInput: Entity)
Parameters
hitInfo: HitInfo
  The information related to the hit against the SceneObject.
sourceOfInput: Entity
  The entity that was hit.
onHoverStart ( sourceOfInput )
Handler for the start of hovers on this SceneObject.
Signature
open fun onHoverStart(sourceOfInput: Entity)
Parameters
sourceOfInput: Entity
  The entity that generated the pointer event.
onHoverStop ( sourceOfInput )
Handler for the termination of hovers on this SceneObject.
Signature
open fun onHoverStop(sourceOfInput: Entity)
Parameters
sourceOfInput: Entity
  The entity that generated the pointer event.
onInput ( hitInfo , sourceOfInput , changed , buttonState , downTime )
Handler to handle generic input.
Signature
open fun onInput(hitInfo: HitInfo, sourceOfInput: Entity, changed: Int, buttonState: Int, downTime: Long): Boolean
Parameters
hitInfo: HitInfo
  The HitInfo object containing information about the hit.
sourceOfInput: Entity
  The entity that generated the pointer event.
changed: Int
  A bit mask of changed button state.
buttonState: Int
  A bit mask of button state.
downTime: Long
  The timestamp when the input interaction began (initial button change)
Returns
Boolean
  Whether the input was handled.
onPointerEvent ( hitInfo , type , sourceOfInput , scrollInfo , semanticType )
Handler to handle pointer events on this SceneObject.
Signature
open fun onPointerEvent(hitInfo: HitInfo, type: Int, sourceOfInput: Entity, scrollInfo: Vector2, semanticType: Int = SemanticType.Unknown.id)
Parameters
hitInfo: HitInfo
  The HitInfo object containing information about the hit.
type: Int
  The type of pointer event.
sourceOfInput: Entity
  The entity that generated the pointer event.
scrollInfo: Vector2
  Scroll speeds in the x and y directions.
semanticType: Int
  The semantic type (e.g. select, grab, etc).
removeInputListener ( id )
Remove an input listener by id.
Signature
fun removeInputListener(id: Long)
Parameters
id: Long
  The id of the input listnener to remove.
reshape ( shapeConfig )
Destroy and recreate the PanelShape with the given config.
Signature
fun reshape(shapeConfig: PanelShapeConfig)
Parameters
shapeConfig: PanelShapeConfig
  The new PanelShapeConfig.
resize ( newWidthInPx , newHeightInPx )
Resizes the panel to the specified dimensions in pixels. This will recreate the panel surface and call resize on the panel display.
Signature
fun resize(newWidthInPx: Int, newHeightInPx: Int)
Parameters
newWidthInPx: Int
  The new width in pixels
newHeightInPx: Int
  The new height in pixels
setIsVisible ( isVisible )
Set whether this SceneObject is visible.
Signature
fun setIsVisible(isVisible: Boolean)
Parameters
isVisible: Boolean
  Whether or not this SceneObjet is visible.
setLocalNodePose ( node , pose )
Sets the local transform of the node (relative to it's parent) to the input pose
Signature
fun setLocalNodePose(node: Int, pose: Pose)
Parameters
node: Int
  : The node id.
pose: Pose
  : The pose.
setLocalNodePoses ( nodePoses )
Sets the local transforms of multiple nodes (relative to their parents) using a map of node ids to poses. This is more efficient than calling setLocalNodePose multiple times as it performs a single batch update.
Signature
fun setLocalNodePoses(nodePoses: Map<Int, Pose>)
Parameters
nodePoses: Map
  Map from node id to pose
setLocalNodePoses ( poses )
Sets the local transforms of multiple nodes (relative to their parents) using a list of poses. This is more efficient than calling setLocalNodePose multiple times as it performs a single batch update. Nodes are indexed sequentially starting from 0.
Signature
fun setLocalNodePoses(poses: List<Pose>)
Parameters
poses: List
  List of poses to apply to nodes starting from node 0
setLocalNodePosesRange ( fromNode , count , poses )
Sets the local transforms of a range of nodes (relative to their parents) using a list of poses. This is more efficient than calling setLocalNodePose multiple times as it performs a single batch update.
Signature
fun setLocalNodePosesRange(fromNode: Int, count: Int, poses: List<Pose>)
Parameters
fromNode: Int
  Starting node id (inclusive)
count: Int
poses: List
  List of poses to apply to nodes in the range [fromNode, toNode)
setLocalNodeTransformsBatch ( nodes , transforms , components )
Sets the local transforms of multiple nodes (relative to their parents) using direct FloatArray buffers. This is the most efficient way to update multiple nodes as it avoids intermediate object allocations. Use this for performance-critical batch updates.
Transform data format depends on components flags:
  • TRANSFORM_TRANSLATION | TRANSFORM_ROTATION (default): 7 floats per node (tx, ty, tz, qw, qx, qy, qz)
  • TRANSFORM_TRANSLATION only: 3 floats per node (tx, ty, tz)
  • TRANSFORM_ROTATION only: 4 floats per node (qw, qx, qy, qz)
  • TRANSFORM_SCALE only: 3 floats per node (sx, sy, sz)
  • TRANSFORM_TRANSLATION | TRANSFORM_SCALE: 6 floats per node (tx, ty, tz, sx, sy, sz)
  • TRANSFORM_ROTATION | TRANSFORM_SCALE: 7 floats per node (qw, qx, qy, qz, sx, sy, sz)
  • TRANSFORM_ALL: 10 floats per node (tx, ty, tz, qw, qx, qy, qz, sx, sy, sz)
Components not set will retain their previous values.
Signature
fun setLocalNodeTransformsBatch(nodes: IntArray, transforms: FloatArray, components: Int = TRANSFORM_TRANSLATION_ROTATION)
Parameters
nodes: IntArray
  Array of node indices to update
transforms: FloatArray
  Packed transform data (size depends on components)
components: Int
  Bitfield of SceneObject.TRANSFORM_* flags (default: TRANSFORM_TRANSLATION_ROTATION)
setLocalNodeTransformsRange ( fromNode , toNode , transforms , components )
Sets the local transforms of a contiguous range of nodes (relative to their parents) using direct FloatArray buffers. This is the most efficient way to update a range of nodes as it avoids intermediate object allocations. Use this for performance-critical batch updates.
Transform data format depends on components flags:
  • TRANSFORM_TRANSLATION | TRANSFORM_ROTATION (default): 7 floats per node (tx, ty, tz, qw, qx, qy, qz)
  • TRANSFORM_TRANSLATION only: 3 floats per node (tx, ty, tz)
  • TRANSFORM_ROTATION only: 4 floats per node (qw, qx, qy, qz)
  • TRANSFORM_SCALE only: 3 floats per node (sx, sy, sz)
  • TRANSFORM_TRANSLATION | TRANSFORM_SCALE: 6 floats per node (tx, ty, tz, sx, sy, sz)
  • TRANSFORM_ROTATION | TRANSFORM_SCALE: 7 floats per node (qw, qx, qy, qz, sx, sy, sz)
  • TRANSFORM_ALL: 10 floats per node (tx, ty, tz, qw, qx, qy, qz, sx, sy, sz)
Components not set will retain their previous values.
Signature
fun setLocalNodeTransformsRange(fromNode: Int, toNode: Int, transforms: FloatArray, components: Int = TRANSFORM_TRANSLATION_ROTATION)
Parameters
fromNode: Int
  Starting node index (inclusive)
toNode: Int
  Ending node index (exclusive)
transforms: FloatArray
  Packed transform data (size depends on components)
components: Int
  Bitfield of SceneObject.TRANSFORM_* flags (default: TRANSFORM_TRANSLATION_ROTATION)
setPosition ( position )
Set the 3D position of this SceneObject.
Signature
fun setPosition(position: Vector3)
Parameters
position: Vector3
  The position as a Vector3 object.
setPosition ( x , y , z )
Set the 3D position of this SceneObject.
Signature
fun setPosition(x: Float, y: Float, z: Float)
Parameters
x: Float
  The x coordinate of the position.
y: Float
  The y coordinate of the position.
z: Float
  The z coordinate of the position.
setRotation ( pitch , yaw , roll )
Set the rotation of this SceneObject.
Signature
fun setRotation(pitch: Float, yaw: Float, roll: Float)
Parameters
pitch: Float
  The pitch of the rotation in degrees.
yaw: Float
  The yaw of the rotation in degrees.
roll: Float
  The roll of the rotation in degrees.
setRotationQuat ( quat )
Set the rotation of this SceneObject.
Signature
fun setRotationQuat(quat: Quaternion)
Parameters
quat: Quaternion
  The quaternion representing the rotation.
setRotationQuat ( x , y , z , w )
Set the rotation of this SceneObject.
Signature
fun setRotationQuat(x: Float, y: Float, z: Float, w: Float)
Parameters
x: Float
  The x component of the quaternion
y: Float
  The y component of the quaternion
z: Float
  The z component of the quaternion
w: Float
  The w component of the quaternion
setScale ( scale )
Set the scale of the model. The default value is 1.0f.
Signature
open override fun setScale(scale: Vector3)
Parameters
scale: Vector3
  The scale represented by a Vector3 object.
setSceneMesh ( mesh , name )
Set the SceneMesh for this SceneObject.
Signature
open fun setSceneMesh(mesh: SceneMesh, name: String)
Parameters
mesh: SceneMesh
  The scene mesh to set on this SceneObject.
name: String
  The name to set on the entity.
shouldFrustumCull ( cull )
Whether this SceneObject can be frustum culled (default is true)
Signature
fun shouldFrustumCull(cull: Boolean)
Parameters
cull: Boolean
  Whether or not this SceneObject can be frustum called.
stopInput ( sourceOfInput , downTime )
This function calls the stopInput function on all InputListener for this SceneObject. This is called automatically by Scene when handling inputs.
Signature
open fun stopInput(sourceOfInput: Entity, downTime: Long)
Parameters
sourceOfInput: Entity
  The controller Entity that triggered the input
downTime: Long
  The timestamp when the input interaction began (initial button change)
updateAnimationTrackToTime ( track , timeInSeconds )
Update the local transforms of the model to match the given animation track at the specified time (matching keyframe time in the glTF).
Track can be found from SceneMesh.getAnimationTracks
Signature
fun updateAnimationTrackToTime(track: Int, timeInSeconds: Float)
Parameters
track: Int
  The track id.
timeInSeconds: Float
  The time in seconds.
updateIsdkComponentProperties ( entity )
Updates the properties of the IsdkPanelDimensions and IsdkCurvedPanel components of the given entity to keep them in sync with the SpatialSDK Toolkit PanelSceneObject.
This method is normally invoked by the IsdkSystem - you will only need to call this method directly if IsdkSystem is disabled.
This method updates the dimensions and local offset of the IsdkPanelDimensions component based on the panel's shape configuration. If the entity does not have an IsdkPanelDimensions component, this method will do nothing.
For QUAD-shaped panels, the width and height are updated based on the panel's shape configuration or the quad configuration options. The local offset is recalculated if necessary, and the field of view (FOV) is set to 0.0f.
For CYLINDER-shaped panels, the width, height, and radius are updated based on the panel's shape configuration or the cylinder configuration options. The FOV is calculated from the radius and width to ensure the correct curvature.
If the panel's shape type is neither of these, a warning is logged, and the method returns without making any changes.
Signature
fun PanelSceneObject.updateIsdkComponentProperties(entity: Entity)
Parameters
entity: Entity
  The entity whose IsdkPanelDimensions and IsdkCurvedPanel components are to be updated.
updateNodeLocalPoseToObjectPose ( node , pose )
Sets the local transform of a node (relative to it's parent) such that the resulting object transform (relative to the model) is placed at the input pose
WARNING: This may be an expensive operation as it recalculates object positions
Signature
fun updateNodeLocalPoseToObjectPose(node: Int, pose: Pose)
Parameters
node: Int
  : The node id.
pose: Pose
  : The pose.
updateSceneMesh ( meshModifier )
Modify and update this SceneObject's mesh.
Signature
fun updateSceneMesh(meshModifier: SceneMesh.() -> Unit)
Parameters
meshModifier: Function1
  The mesh modifier to apply to this SceneObject's mesh.
Did you find this page helpful?