systemManager.findSystem<SceneObjectSystem>().getSceneObject(myEntity)?.thenAccept { sceneObject -> sceneObject.addInputListener(myInputListener) }
open class SceneObject
SceneObject
(
scene
, mesh
, name
, entity
)
|
Constructor for a SceneObject.
Signature
constructor(scene: Scene, mesh: SceneMesh, name: String, entity: Entity? = null) Parameters Returns |
SceneObject
(
scene
, entity
)
|
Constructor for a SceneObject.
Signature
constructor(scene: Scene, entity: Entity? = null) Parameters Returns |
entity
:
Entity?
[Get] |
Signature
val entity: Entity? |
handle
:
Long
[Get] |
Signature
var handle: Long |
materials
:
Array?
[Get] |
Array of SceneMaterials created from this SceneObject's mesh property. Changes to the materials in this array will be unique to this SceneObject, but these materials will inhererit any changes made in the SceneMesh they come from.
Signature
var materials: Array<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? |
addInputListener
(
listener
)
|
Add an input listener to this SceneObject.
Signature
fun addInputListener(listener: InputListener): Long Parameters
listener:
InputListener Returns
Long
|
destroy
()
|
Destory this SceneObject.
Signature
fun destroy() |
destroyInternal
()
|
Destroy this SceneObject's native components.
Signature
open fun destroyInternal() |
onClick
(
hitInfo
, sourceOfInput
)
| |
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) |
onHoverStart
(
sourceOfInput
)
|
Handler for the start of hovers on this SceneObject.
Signature
open fun onHoverStart(sourceOfInput: Entity) Parameters
sourceOfInput:
Entity |
onHoverStop
(
sourceOfInput
)
|
Handler for the termination of hovers on this SceneObject.
Signature
open fun onHoverStop(sourceOfInput: Entity) Parameters
sourceOfInput:
Entity |
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
sourceOfInput:
Entity
changed:
Int
buttonState:
Int
downTime:
Long
Returns
Boolean
|
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
type:
Int
sourceOfInput:
Entity
scrollInfo:
Vector2
semanticType:
Int
|
removeInputListener
(
id
)
|
Remove an input listener by id.
Signature
fun removeInputListener(id: Long) Parameters
id:
Long
|
setIsVisible
(
isVisible
)
|
Set whether this SceneObject is visible.
Signature
fun setIsVisible(isVisible: Boolean) Parameters
isVisible:
Boolean
|
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
pose:
Pose |
setPosition
(
x
, y
, z
)
|
Set the 3D position of this SceneObject.
Signature
fun setPosition(x: Float, y: Float, z: Float) Parameters
x:
Float
y:
Float
z:
Float
|
setPosition
(
position
)
|
Set the 3D position of this SceneObject.
Signature
fun setPosition(position: Vector3) Parameters
position:
Vector3 |
setRotation
(
pitch
, yaw
, roll
)
|
Set the rotation of this SceneObject.
Signature
fun setRotation(pitch: Float, yaw: Float, roll: Float) Parameters
pitch:
Float
yaw:
Float
roll:
Float
|
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
y:
Float
z:
Float
w:
Float
|
setRotationQuat
(
quat
)
|
Set the rotation of this SceneObject.
Signature
fun setRotationQuat(quat: Quaternion) Parameters
quat:
Quaternion |
setScale
(
scale
)
|
Set the scale of the model. The default value is 1.0f.
Signature
open fun setScale(scale: Vector3) Parameters
scale:
Vector3 |
setSceneMesh
(
mesh
, name
)
| |
shouldFrustumCull
(
cull
)
|
Whether this SceneObject can be frustum culled (default is true)
Signature
fun shouldFrustumCull(cull: Boolean) Parameters
cull:
Boolean
|
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
downTime:
Long
|
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
timeInSeconds:
Float
|
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
pose:
Pose |
updateSceneMesh
(
meshModifier
)
|
Modify and update this SceneObject's mesh.
Signature
fun updateSceneMesh(meshModifier: SceneMesh.() -> Unit) Parameters
meshModifier:
Function1
|