class InputEvent


Defines input events for XRCore.

Summary

Nested types

Information about the hit result of the ray.

Constants

const Int

While the primary action button or gesture was held, the pointer was disabled.

const Int

The primary action button or gesture was just pressed / started.

const Int

The primary action button or gesture is not pressed, and the pointer ray started to hit a new node.

const Int

The primary action button or gesture is not pressed, and the pointer ray stopped hitting the node that it was previously hitting.

const Int

The primary action button or gesture is not pressed, and the pointer ray continued to hit the same node.

const Int

The primary action button or gesture was pressed/active in the previous event, and is still pressed/active.

const Int

The primary action button or gesture was just released / stopped.

const Int

Default pointer type for the source (no handedness).

const Int

Left hand / controller pointer.

const Int

Right hand / controller pointer.

const Int

Event is based on (one of) the user's controller(s).

const Int

Event is based on a mix of the head, eyes, and hands.

const Int

Event is based on one of the user's hands.

const Int

Event is based on the user's head.

const Int

Event is based on a 2D mouse pointing device.

const Int

Unknown source.

Public constructors

InputEvent(
    source: Int,
    pointerType: Int,
    timestamp: Long,
    origin: Vector3,
    direction: Vector3,
    action: Int,
    hitInfo: InputEvent.HitInfo?,
    secondaryHitInfo: InputEvent.HitInfo?
)

Public functions

open operator Boolean
equals(other: Any?)
open Int

Public properties

Int

Actions similar to Android's MotionEvent for keeping track of a sequence of events on the same target, e.g., * HOVER_ENTER -> HOVER_MOVE -> HOVER_EXIT * DOWN -> MOVE -> UP

Vector3

A point indicating the direction the ray is pointing, in the receiver's activity space.

InputEvent.HitInfo?

Info about the first scene entity (closest to the ray origin) that was hit by the input ray, if any.

Vector3

The origin of the ray in the receiver's activity space.

Int

Type of the individual pointer.

InputEvent.HitInfo?

Info about the second scene entity from the same task that was hit, if any.

Int

Type of device that generated this event.

Long

Timestamp from android.os.SystemClock#uptimeMillis time base.

Constants

ACTION_CANCEL

const val ACTION_CANCEL = 3: Int

While the primary action button or gesture was held, the pointer was disabled. This happens if you are using controllers and the battery runs out, or if you are using a source that transitions to a new pointer type, eg SOURCE_GAZE_AND_GESTURE.

ACTION_DOWN

const val ACTION_DOWN = 0: Int

The primary action button or gesture was just pressed / started.

ACTION_HOVER_ENTER

const val ACTION_HOVER_ENTER = 5: Int

The primary action button or gesture is not pressed, and the pointer ray started to hit a new node. The hit info represents the node that is being hit (may be null if pointer capture is enabled).

Hover input events are never provided for sensitive source types.

ACTION_HOVER_EXIT

const val ACTION_HOVER_EXIT = 6: Int

The primary action button or gesture is not pressed, and the pointer ray stopped hitting the node that it was previously hitting. The hit info represents the node that was being hit (may be null if pointer capture is enabled).

Hover input events are never provided for sensitive source types.

ACTION_HOVER_MOVE

const val ACTION_HOVER_MOVE = 4: Int

The primary action button or gesture is not pressed, and the pointer ray continued to hit the same node. The hit info represents the node that was hit (may be null if pointer capture is enabled).

Hover input events are never provided for sensitive source types.

ACTION_MOVE

const val ACTION_MOVE = 2: Int

The primary action button or gesture was pressed/active in the previous event, and is still pressed/active. The hit info represents the node that was originally hit (ie, as provided in the ACTION_DOWN event). The hit position may be null if the pointer is no longer hitting that node.

ACTION_UP

const val ACTION_UP = 1: Int

The primary action button or gesture was just released / stopped. The hit info represents the node that was originally hit (ie, as provided in the ACTION_DOWN event).

POINTER_TYPE_DEFAULT

const val POINTER_TYPE_DEFAULT = 0: Int

Default pointer type for the source (no handedness). Occurs for SOURCE_UNKNOWN, SOURCE_HEAD, SOURCE_MOUSE, and SOURCE_GAZE_AND_GESTURE.

POINTER_TYPE_LEFT

const val POINTER_TYPE_LEFT = 1: Int

Left hand / controller pointer. Occurs for SOURCE_CONTROLLER, SOURCE_HANDS, and SOURCE_GAZE_AND_GESTURE.

POINTER_TYPE_RIGHT

const val POINTER_TYPE_RIGHT = 2: Int

Right hand / controller pointer. Occurs for SOURCE_CONTROLLER, SOURCE_HANDS, and SOURCE_GAZE_AND_GESTURE.

SOURCE_CONTROLLER

const val SOURCE_CONTROLLER = 2: Int

Event is based on (one of) the user's controller(s). Ray origin and direction are for a controller aim pose as defined by OpenXR. Action state is based on the primary button on the controller, usually the bottom-most face button.

SOURCE_GAZE_AND_GESTURE

const val SOURCE_GAZE_AND_GESTURE = 5: Int

Event is based on a mix of the head, eyes, and hands. Ray origin is at average between eyes and points in direction based on a mix of eye gaze direction and hand motion. During a two-handed zoom/rotate gesture, left/right pointer events will be issued; otherwise, default events are issued based on the gaze ray. Action state is based on if the user has done a pinch gesture or not.

Events from this source are considered sensitive and hover events are never sent.

SOURCE_HANDS

const val SOURCE_HANDS = 3: Int

Event is based on one of the user's hands. Ray is a hand aim pose, with origin between thumb and forefinger and points in direction based on hand orientation. Action state is based on a pinch gesture.

SOURCE_HEAD

const val SOURCE_HEAD = 1: Int

Event is based on the user's head. Ray origin is at average between eyes, pushed out to the near clipping plane for both eyes and points in direction head is facing. Action state is based on volume up button being depressed.

Events from this source are considered sensitive and hover events are never sent.

SOURCE_MOUSE

const val SOURCE_MOUSE = 4: Int

Event is based on a 2D mouse pointing device. Ray origin behaves the same as for SOURCE_HEAD and points in direction based on mouse movement. During a drag, the ray origin moves approximating hand motion. The scrollwheel moves the ray away from / towards the user. Action state is based on the primary mouse button.

SOURCE_UNKNOWN

const val SOURCE_UNKNOWN = 0: Int

Unknown source.

Public constructors

InputEvent

Added in 1.0.0-alpha01
InputEvent(
    source: Int,
    pointerType: Int,
    timestamp: Long,
    origin: Vector3,
    direction: Vector3,
    action: Int,
    hitInfo: InputEvent.HitInfo? = null,
    secondaryHitInfo: InputEvent.HitInfo? = null
)
Parameters
source: Int

Type of device that generated this event.

pointerType: Int

Type of the individual pointer.

timestamp: Long

Timestamp from android.os.SystemClock#uptimeMillis time base.

origin: Vector3

The origin of the ray in the receiver's activity space.

direction: Vector3

A point indicating the direction the ray is pointing, in the receiver's activity space.

action: Int

Actions similar to Android's MotionEvent for keeping track of a sequence of events on the same target, e.g., * HOVER_ENTER -> HOVER_MOVE -> HOVER_EXIT * DOWN -> MOVE -> UP

hitInfo: InputEvent.HitInfo? = null

Info about the first scene entity (closest to the ray origin) that was hit by the input ray, if any. This will be null if no entity was hit. Note that the hit entity remains the same during an ongoing DOWN -> MOVE -> UP action, even if the pointer stops hitting the entity during the action.

secondaryHitInfo: InputEvent.HitInfo? = null

Info about the second scene entity from the same task that was hit, if any.

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

Public properties

action

Added in 1.0.0-alpha01
val actionInt

Actions similar to Android's MotionEvent for keeping track of a sequence of events on the same target, e.g., * HOVER_ENTER -> HOVER_MOVE -> HOVER_EXIT * DOWN -> MOVE -> UP

direction

Added in 1.0.0-alpha01
val directionVector3

A point indicating the direction the ray is pointing, in the receiver's activity space.

hitInfo

Added in 1.0.0-alpha01
val hitInfoInputEvent.HitInfo?

Info about the first scene entity (closest to the ray origin) that was hit by the input ray, if any. This will be null if no entity was hit. Note that the hit entity remains the same during an ongoing DOWN -> MOVE -> UP action, even if the pointer stops hitting the entity during the action.

origin

Added in 1.0.0-alpha01
val originVector3

The origin of the ray in the receiver's activity space.

pointerType

Added in 1.0.0-alpha01
val pointerTypeInt

Type of the individual pointer.

secondaryHitInfo

Added in 1.0.0-alpha01
val secondaryHitInfoInputEvent.HitInfo?

Info about the second scene entity from the same task that was hit, if any.

source

Added in 1.0.0-alpha01
val sourceInt

Type of device that generated this event.

timestamp

Added in 1.0.0-alpha01
val timestampLong

Timestamp from android.os.SystemClock#uptimeMillis time base.