# Ray

> Representation of rays.

## Definition

* **Type:** Struct
* **Namespace:** [UnityEngine](/engine/6000.0/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule
* **Implements:** [IFormattable](https://learn.microsoft.com/dotnet/api/system.iformattable)

```csharp
public struct Ray : IFormattable
```

## Remarks

A ray is an infinite line starting at [Ray.origin](/engine/6000.0/script-reference/unityengine/ray/origin.md) and going in some [Ray.direction](/engine/6000.0/script-reference/unityengine/ray/direction.md).

## Constructors

| Constructor                                                                                             | Description                                       |
| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
| [Ray(UnityEngine.Vector3,UnityEngine.Vector3)](/engine/6000.0/script-reference/unityengine/ray/ctor.md) | Creates a ray starting at origin along direction. |

## Properties

| Property                                                                  | Description                  |
| ------------------------------------------------------------------------- | ---------------------------- |
| [direction](/engine/6000.0/script-reference/unityengine/ray/direction.md) | The direction of the ray.    |
| [origin](/engine/6000.0/script-reference/unityengine/ray/origin.md)       | The origin point of the ray. |

## Methods

| Method                                                                  | Description                                      |
| ----------------------------------------------------------------------- | ------------------------------------------------ |
| [GetPoint](/engine/6000.0/script-reference/unityengine/ray/getpoint.md) | Returns a point at distance units along the ray. |
| [ToString](/engine/6000.0/script-reference/unityengine/ray/tostring.md) | Returns a formatted string for this ray.         |
