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

*** ** * ** ***


```
public final class Ray
```

<br />

*** ** * ** ***

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

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/xr/runtime/math/Ray#Ray(androidx.xr.runtime.math.Ray)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/xr/runtime/math/Ray other)` Creates a new Ray with the same values as the `https://developer.android.com/reference/androidx/xr/runtime/math/Ray#(androidx.xr.runtime.math.Ray)` ray. |
| `https://developer.android.com/reference/androidx/xr/runtime/math/Ray#Ray(androidx.xr.runtime.math.Vector3,androidx.xr.runtime.math.Vector3)(@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)` |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/xr/runtime/math/Ray#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` Returns true if this ray is equal to the `https://developer.android.com/reference/androidx/xr/runtime/math/Ray#equals(kotlin.Any)` ray. |
| `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/runtime/math/Ray#getDirection()()` the direction of the ray |
| `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/runtime/math/Ray#getOrigin()()` the origin of the ray |
| `int` | `https://developer.android.com/reference/androidx/xr/runtime/math/Ray#hashCode()()` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/xr/runtime/math/Ray#toString()()` |

## Public constructors

### Ray

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

```
public Ray(@NonNull Ray other)
```

Creates a new Ray with the same values as the `https://developer.android.com/reference/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)

```
public Ray(@NonNull Vector3 origin, @NonNull Vector3 direction)
```

## Public methods

### equals

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

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

### getDirection

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

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

the direction of the ray

### getOrigin

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

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

the origin of the ray

### hashCode

```
public int hashCode()
```

### toString

```
public @NonNull String toString()
```