# HitTestResult

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/HitTestResult.kt+class:androidx.xr.scenecore.HitTestResult) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/xr-scenecore#1.0.0)

*** ** * ** ***


```
class HitTestResult
```

<br />

*** ** * ** ***

Specifies an intersection between a ray and the Scene.

This can be obtained by running `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/ScenePose#hitTest(androidx.xr.runtime.math.Vector3,androidx.xr.runtime.math.Vector3)` and related methods.

## Summary

| ### Nested types |
|---|
| `object https://developer.android.com/reference/kotlin/androidx/xr/scenecore/HitTestResult.SurfaceType` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/HitTestResult#HitTestResult(androidx.xr.runtime.math.Vector3,androidx.xr.runtime.math.Vector3,kotlin.Int,kotlin.Float)( hitPosition: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3, surfaceNormal: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3?, surfaceType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, distance: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` |

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

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/HitTestResult#distance()` the distance from the origin to the hit location. |
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/HitTestResult#hitPosition()` the `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` position of the intersection between a ray and the Scene. |
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3?` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/HitTestResult#surfaceNormal()` The normal of the surface of the Entity or surface that was hit, or null if the normal could not be computed. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/HitTestResult#surfaceType()` the `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/HitTestResult.SurfaceType` that was hit. |

## Public constructors

### HitTestResult

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

```
HitTestResult(
    hitPosition: Vector3,
    surfaceNormal: Vector3?,
    surfaceType: Int,
    distance: Float
)
```

## Public functions

### equals

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

### hashCode

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

## Public properties

### distance

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

```
val distance: Float
```

the distance from the origin to the hit location.

### hitPosition

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

```
val hitPosition: Vector3
```

the `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` position of the intersection between a ray and the Scene.

### surfaceNormal

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

```
val surfaceNormal: Vector3?
```

The normal of the surface of the Entity or surface that was hit, or null if the normal could not be computed.

### surfaceType

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

```
val surfaceType: Int
```

the `https://developer.android.com/reference/kotlin/androidx/xr/scenecore/HitTestResult.SurfaceType` that was hit.

Value is one of the following:

- `0`
- `1`
- `2`

<br />