# 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)

*** ** * ** ***


```
public final class InputEvent
```

<br />

*** ** * ** ***

Defines input events for SceneCore.

## Summary

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

| ### Public constructors |
|---|
| `https://developer.android.com/reference/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)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/InputEvent.Source source, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/InputEvent.Pointer pointerType, long timestamp, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 origin, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 direction, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/InputEvent.Action action, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/InputEvent.HitInfo> hitInfoList )` |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/xr/scenecore/InputEvent#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/InputEvent.Action` | `https://developer.android.com/reference/androidx/xr/scenecore/InputEvent#getAction()()` 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. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3` | `https://developer.android.com/reference/androidx/xr/scenecore/InputEvent#getDirection()()` A point indicating the direction the ray is pointing, in the receiver's activity space. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/InputEvent.HitInfo>` | `https://developer.android.com/reference/androidx/xr/scenecore/InputEvent#getHitInfoList()()` List of `https://developer.android.com/reference/androidx/xr/scenecore/InputEvent.HitInfo` for the scene entities from the same task that were hit by the input ray, if any. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3` | `https://developer.android.com/reference/androidx/xr/scenecore/InputEvent#getOrigin()()` The origin of the ray in the receiver's activity space. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/InputEvent.Pointer` | `https://developer.android.com/reference/androidx/xr/scenecore/InputEvent#getPointerType()()` Type of the individual pointer (e.g. left, right or default) for this event. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/InputEvent.Source` | `https://developer.android.com/reference/androidx/xr/scenecore/InputEvent#getSource()()` Type of source (e.g. hands, controller, head) that generated this event. |
| `final long` | `https://developer.android.com/reference/androidx/xr/scenecore/InputEvent#getTimestamp()()` Timestamp from [SystemClock.uptimeMillis](https://developer.android.com/reference/android/os/SystemClock#uptimeMillis()) time base. |
| `int` | `https://developer.android.com/reference/androidx/xr/scenecore/InputEvent#hashCode()()` |

## Public constructors

### InputEvent

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

```
public InputEvent(
    @NonNull InputEvent.Source source,
    @NonNull InputEvent.Pointer pointerType,
    long timestamp,
    @NonNull Vector3 origin,
    @NonNull Vector3 direction,
    @NonNull InputEvent.Action action,
    @NonNull List<@NonNull InputEvent.HitInfo> hitInfoList
)
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/InputEvent.Source source` | Type of source (e.g. hands, controller, head) that generated this event. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/InputEvent.Pointer pointerType` | Type of the individual pointer (e.g. left, right or default) for this event. |
| `long timestamp` | Timestamp from [SystemClock.uptimeMillis](https://developer.android.com/reference/android/os/SystemClock#uptimeMillis()) time base. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 origin` | The origin of the ray in the receiver's activity space. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Vector3 direction` | A point indicating the direction the ray is pointing, in the receiver's activity space. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/InputEvent.Action 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/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/scenecore/InputEvent.HitInfo> hitInfoList` | List of `https://developer.android.com/reference/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 methods

### equals

```
public boolean equals(Object other)
```

### getAction

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

```
public final @NonNull InputEvent.Action getAction()
```

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.

### getDirection

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

```
public final @NonNull Vector3 getDirection()
```

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

### getHitInfoList

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

```
public final @NonNull List<@NonNull InputEvent.HitInfo> getHitInfoList()
```

List of `https://developer.android.com/reference/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.

### getOrigin

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

```
public final @NonNull Vector3 getOrigin()
```

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

### getPointerType

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

```
public final @NonNull InputEvent.Pointer getPointerType()
```

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

### getSource

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

```
public final @NonNull InputEvent.Source getSource()
```

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

### getTimestamp

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

```
public final long getTimestamp()
```

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

### hashCode

```
public int hashCode()
```