# InputEvent

Artifact: [androidx.xr.scenecore:scenecore](https://developer.android.com/jetpack/androidx/releases/xr-scenecore) [View Source](https://cs.android.com/search?q=file:androidx/xr/scenecore/InputEvent.kt+class:androidx.xr.scenecore.InputEvent) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

*** ** * ** ***


```
class InputEvent
```

<br />

*** ** * ** ***

Defines input events for SceneCore.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.Action` Specifies the action (e.g. down, up, move, etc.) of the input event. |
| `class https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.HitInfo` Information about the hit result of the input ray, originating from one of the `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.Source`, and intersecting with some `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/Entity` on the scene. |
| `class https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.Pointer` Specifies the pointer type (e.g. left, right or default) of the input event. |
| `class https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.Source` Specifies the source (e.g. hands, controller, head) of the input event. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent#InputEvent(androidx.xr.scenecore.InputEvent.Source,androidx.xr.scenecore.InputEvent.Pointer,kotlin.Long,androidx.xr.runtime.math.Vector3,androidx.xr.runtime.math.Vector3,androidx.xr.scenecore.InputEvent.Action,kotlin.collections.List)( source: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.Source, pointerType: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.Pointer, timestamp: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, origin: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3, direction: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3, action: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.Action, hitInfoList: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.HitInfo> )` |

| ### Public functions |
|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent#hashCode()()` |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.Action` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent#action()` Actions similar to Android's [MotionEvent](https://developer.android.com/reference/android/view/MotionEvent) for keeping track of a sequence of events on the same target, e.g., HOVER_ENTER -\> HOVER_MOVE -\> HOVER_EXIT, DOWN -\> MOVE -\> UP. |
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent#direction()` A point indicating the direction the ray is pointing, in the receiver's activity space. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.HitInfo>` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent#hitInfoList()` List of `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.HitInfo` for the scene entities from the same task that were hit by the input ray, if any. |
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent#origin()` The origin of the ray in the receiver's activity space. |
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.Pointer` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent#pointerType()` Type of the individual pointer (e.g. left, right or default) for this event. |
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.Source` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent#source()` Type of source (e.g. hands, controller, head) that generated this event. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent#timestamp()` Timestamp from [SystemClock.uptimeMillis](https://developer.android.com/reference/android/os/SystemClock#uptimeMillis()) time base. |

## Public constructors

### InputEvent

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
InputEvent(
    source: InputEvent.Source,
    pointerType: InputEvent.Pointer,
    timestamp: Long,
    origin: Vector3,
    direction: Vector3,
    action: InputEvent.Action,
    hitInfoList: List<InputEvent.HitInfo> = emptyList()
)
```

| Parameters |
|---|---|
| `source: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.Source` | Type of source (e.g. hands, controller, head) that generated this event. |
| `pointerType: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.Pointer` | Type of the individual pointer (e.g. left, right or default) for this event. |
| `timestamp: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | Timestamp from [SystemClock.uptimeMillis](https://developer.android.com/reference/android/os/SystemClock#uptimeMillis()) time base. |
| `origin: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` | The origin of the ray in the receiver's activity space. |
| `direction: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` | A point indicating the direction the ray is pointing, in the receiver's activity space. |
| `action: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.Action` | Actions similar to Android's [MotionEvent](https://developer.android.com/reference/android/view/MotionEvent) for keeping track of a sequence of events on the same target, e.g., HOVER_ENTER -\> HOVER_MOVE -\> HOVER_EXIT, DOWN -\> MOVE -\> UP. |
| `hitInfoList: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.HitInfo> = emptyList()` | List of `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.HitInfo` for the scene entities from the same task that were hit by the input ray, if any. The list is sorted from closest to farthest from the ray origin. Note that this first hit entity remains the same during an ongoing DOWN -\> MOVE -\> UP action, even if the pointer stops hitting the entity during the action. |

## Public functions

### equals

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

### hashCode

```
open fun hashCode(): Int
```

## Public properties

### action

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
val action: InputEvent.Action
```

Actions similar to Android's [MotionEvent](https://developer.android.com/reference/android/view/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](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
val direction: Vector3
```

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

### hitInfoList

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
val hitInfoList: List<InputEvent.HitInfo>
```

List of `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.HitInfo` for the scene entities from the same task that were hit by the input ray, if any. The list is sorted from closest to farthest from the ray origin. Note that this first 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](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
val origin: Vector3
```

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

### pointerType

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
val pointerType: InputEvent.Pointer
```

Type of the individual pointer (e.g. left, right or default) for this event.

### source

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
val source: InputEvent.Source
```

Type of source (e.g. hands, controller, head) that generated this event.

### timestamp

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

```
val timestamp: Long
```

Timestamp from [SystemClock.uptimeMillis](https://developer.android.com/reference/android/os/SystemClock#uptimeMillis()) time base.