# Ray

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

*** ** * ** ***


```
class Ray
```

<br />

*** ** * ** ***

Ray in 3D space defined by an origin point and a direction vector.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Ray#Ray(androidx.xr.runtime.math.Ray)(other: https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Ray)` Creates a new Ray with the same values as the `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Ray#(androidx.xr.runtime.math.Ray)` ray. |
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Ray#Ray(androidx.xr.runtime.math.Vector3,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/runtime/math/Ray#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` Returns true if this ray is equal to the `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Ray#equals(kotlin.Any)` ray. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Ray#hashCode()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Ray#toString()()` |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` | `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Ray#direction()` the direction of the ray |
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` | `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Ray#origin()` the origin of the ray |

## Public constructors

### Ray

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

```
Ray(other: Ray)
```

Creates a new Ray with the same values as the `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Ray#(androidx.xr.runtime.math.Ray)` ray.

### Ray

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

```
Ray(origin: Vector3 = Vector3(), direction: Vector3 = Vector3())
```

## Public functions

### equals

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

Returns true if this ray is equal to the `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Ray#equals(kotlin.Any)` ray.

### hashCode

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

### toString

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

## Public properties

### direction

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

```
val direction: Vector3
```

the direction of the ray

### origin

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

```
val origin: Vector3
```

the origin of the ray