# sm.physics.distanceRaycast

Performs a distance <a target="_blank" href="https://en.wikipedia.org/wiki/Ray_casting">ray cast</a> from a position with a given direction.

**Kind:** Function

**Environments:** Game

## Game

``` { .lua .api-signature }
sm.physics.distanceRaycast( start, direction )
```

[Open the full Game reference](../Game-Script-Environment/Static-Functions/sm.physics.md#distanceraycast)

> **Note:**
> [sm.physics.distanceRaycast](../Game-Script-Environment/Static-Functions/sm.physics.md#distanceraycast) is generally cheaper to use than [sm.physics.raycast](../Game-Script-Environment/Static-Functions/sm.physics.md#raycast) as it performs collision checks in a simplified world. If the raycast is only used for checking collision, it is advised to use this method instead.

**Parameters:**

| Name | Type | Description |
| --- | --- | --- |
| `start` | [Vec3](../Game-Script-Environment/Userdata/Vec3.md) | The start position. |
| `direction` | [Vec3](../Game-Script-Environment/Userdata/Vec3.md) | The ray's direction and length. |

**Returns:**

| Type | Description |
| --- | --- |
| boolean | 2 values: whether raycast was successful |
| number | the fraction (0&ndash;1) of the distance reached until collision divided by the ray's length. |
