# sm.localPlayer.getRaycast

Performs a <a target="_blank" href="https://en.wikipedia.org/wiki/Ray_casting">raycast</a> relative to the local player's perspective.

**Kind:** Function

**Environments:** Game

## Game

``` { .lua .api-signature }
sm.localPlayer.getRaycast( range, origin?, direction? )
```

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

**Availability:** Client only

**Parameters:**

| Name | Type | Description |
| --- | --- | --- |
| `range` | number | The maximum range. |
| `origin` *(optional)* | [Vec3](../Game-Script-Environment/Userdata/Vec3.md) | The start position. (Defaults to [sm.localPlayer.getRaycastStart](../Game-Script-Environment/Static-Functions/sm.localPlayer.md#getraycaststart)) |
| `direction` *(optional)* | [Vec3](../Game-Script-Environment/Userdata/Vec3.md) | The direction. (Defaults to [sm.localPlayer.getDirection](../Game-Script-Environment/Static-Functions/sm.localPlayer.md#getdirection)) |

**Returns:**

| Type | Description |
| --- | --- |
| bool | True if raycast was successful |
| [RaycastResult](../Game-Script-Environment/Userdata/RaycastResult.md) | Raycast result data. |
