interface InputListener
// Create a custom input listener
val myInputListener = object : InputListener {
override fun onClick(receiver: SceneObject, hitInfo: HitInfo, sourceOfInput: Entity) {
// Handle click event
}
}
// Attach the input listener to the SceneObject
val sceneObject = systemManager.findSystem<SceneObjectSystem>().getSceneObject(entity)
sceneObject?.thenAccept { so ->
so.addInputListener(myInputListener)
}
| Name | Summary |
|---|---|
onClick | open fun onClick(receiver: SceneObject, hitInfo: HitInfo, sourceOfInput: Entity) Called when a "click" is released while pointing at the object. This is a trigger release for controllers, and a pinch release for hands. |
onClickDown | open fun onClickDown(receiver: SceneObject, hitInfo: HitInfo, sourceOfInput: Entity) Called when a "clickDown" is processed while pointing at the object. This is a trigger press for controllers, and a pinch for hands. |
onHoverStart | open fun onHoverStart(receiver: SceneObject, sourceOfInput: Entity) Called when the pointer starts hovering over the object. |
onHoverStop | open fun onHoverStop(receiver: SceneObject, sourceOfInput: Entity) Called when the pointer stops hovering over the object. |
onInput | open fun onInput(receiver: SceneObject, hitInfo: HitInfo, sourceOfInput: Entity, changed: Int, buttonState: Int, downTime: Long): Boolean Called when any input event occurs on the object. It provides raw button state information through bit masks that can be interpreted using ButtonBits constants. |
onPointerEvent | open fun onPointerEvent(receiver: SceneObject, hitInfo: HitInfo, type: Int, sourceOfInput: Entity, scrollInfo: Vector2, semanticType: Int) Called for pointer events on the SceneObject. |
stopInput | open fun stopInput(receiver: SceneObject, sourceOfInput: Entity, downTime: Long) Called when input interaction with a SceneObject stops. This will be called once the controller stops hovering, or if a button is held down, when the button is released. |