# HitResult

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

*** ** * ** ***


```
class HitResult
```

<br />

*** ** * ** ***

Intersection between a ray and estimated real-world geometry.

Can be obtained from `https://developer.android.com/reference/kotlin/androidx/xr/arcore/package-summary#hitTest(androidx.xr.runtime.Session,androidx.xr.runtime.math.Ray)`. If the ray intersects a `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Plane` that is being subsumed, the subsuming `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Plane` will be returned.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Anchorable#createAnchor(androidx.xr.runtime.math.Pose)` |   |

## Summary

| ### Public functions |
|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/arcore/HitResult#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/arcore/HitResult#hashCode()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/arcore/HitResult#toString()()` Returns a string representation of `https://developer.android.com/reference/kotlin/androidx/xr/arcore/HitResult` for debugging. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/arcore/HitResult#distance()` the distance from the camera to the hit location, in meters |
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Pose` | `https://developer.android.com/reference/kotlin/androidx/xr/arcore/HitResult#hitPose()` the `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Pose` of the intersection between a ray and the `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Trackable` in the world coordinate space |
| `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Trackable<https://developer.android.com/reference/kotlin/androidx/xr/arcore/Trackable.State>` | `https://developer.android.com/reference/kotlin/androidx/xr/arcore/HitResult#trackable()` the `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Trackable` that was hit |

## Public functions

### equals

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

### hashCode

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

### toString

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

Returns a string representation of `https://developer.android.com/reference/kotlin/androidx/xr/arcore/HitResult` for debugging.

Note: Not intended for production use.

## Public properties

### distance

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

```
val distance: Float
```

the distance from the camera to the hit location, in meters

### hitPose

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

```
val hitPose: Pose
```

the `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Pose` of the intersection between a ray and the `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Trackable` in the world coordinate space

If the hit `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Trackable` is a `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Plane`, the hitPose will be parallel to the `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Pose` of the `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Plane`.

The hit `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Trackable` may also be an instance of `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Anchorable`. If so, an anchor representing the hit position can be created from the `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Anchorable`

### trackable

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

```
val trackable: Trackable<Trackable.State>
```

the `https://developer.android.com/reference/kotlin/androidx/xr/arcore/Trackable` that was hit