# SpatialInputEvent

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


```
class SpatialInputEvent
```

<br />

*** ** * ** ***

Defines Spatial input events for Compose, representing a user's input in 3D space. These are fired when an `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/InteractionPolicy` is attached to a Composable.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialInputEvent#SpatialInputEvent(androidx.xr.scenecore.InputEvent.Source,androidx.xr.scenecore.InputEvent.Pointer,androidx.xr.scenecore.InputEvent.Action,kotlin.Long,androidx.xr.runtime.math.Vector3,androidx.xr.runtime.math.Vector3,androidx.xr.runtime.math.Vector3)( source: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.Source, pointerType: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.Pointer, action: https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.Action, timestamp: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, hitPosition: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3?, origin: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3, direction: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3 )` |

| ### Public functions |
|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialInputEvent#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/compose/subspace/layout/SpatialInputEvent#hashCode()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialInputEvent#toString()()` |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.Action` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialInputEvent#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/compose/subspace/layout/SpatialInputEvent#direction()` A point indicating the direction the ray is pointing, in the receiver's activity space, in pixels. |
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3?` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialInputEvent#hitPosition()` The offset of the point of interaction, in pixels, relative to the center of the Composable this input targets. |
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialInputEvent#origin()` The origin of the ray in the receiver's activity space, in pixels. |
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.Pointer` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialInputEvent#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/compose/subspace/layout/SpatialInputEvent#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/compose/subspace/layout/SpatialInputEvent#timestamp()` Timestamp from [SystemClock.uptimeMillis](https://developer.android.com/reference/android/os/SystemClock#uptimeMillis()) time base. |

## Public constructors

### SpatialInputEvent

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

```
SpatialInputEvent(
    source: InputEvent.Source,
    pointerType: InputEvent.Pointer,
    action: InputEvent.Action,
    timestamp: Long,
    hitPosition: Vector3?,
    origin: Vector3,
    direction: Vector3
)
```

| 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. |
| `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. |
| `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. |
| `hitPosition: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3?` | The offset of the point of interaction, in pixels, relative to the center of the Composable this input targets. This is null if an input ray no longer hits the Composable during an `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.Action` sequence. |
| `origin: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` | The origin of the ray in the receiver's activity space, in pixels. |
| `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, in pixels. |

## Public functions

### equals

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

### hashCode

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

### toString

```
open fun toString(): String
```

## Public properties

### action

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

```
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-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
val direction: Vector3
```

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

### hitPosition

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

```
val hitPosition: Vector3?
```

The offset of the point of interaction, in pixels, relative to the center of the Composable this input targets. This is null if an input ray no longer hits the Composable during an `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/InputEvent.Action` sequence.

### origin

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

```
val origin: Vector3
```

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

### pointerType

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

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

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

### source

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

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

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

### timestamp

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

```
val timestamp: Long
```

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