# sm.physics.raycast

Performs a <a target="_blank" href="https://en.wikipedia.org/wiki/Ray_casting">ray cast</a> between two positions.

**Kind:** Function

**Environments:** Game

## Game

``` { .lua .api-signature }
sm.physics.raycast( start, end, body?, mask?, world?, ignoreUuids? )
```

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

The returned [RaycastResult](../Game-Script-Environment/Userdata/RaycastResult.md) contains information about any object intersected by the ray.

If the ray cast is called from within a shape (e.g. a Sensor), a [Body](../Game-Script-Environment/Userdata/Body.md) may be provided which the ray will not intersect.

**Parameters:**

| Name | Type | Description |
| --- | --- | --- |
| `start` | [Vec3](../Game-Script-Environment/Userdata/Vec3.md) | The start position. |
| `end` | [Vec3](../Game-Script-Environment/Userdata/Vec3.md) | The end position. |
| `body` *(optional)* | [Body](../Game-Script-Environment/Userdata/Body.md) | The body to be ignored. (Optional) |
| `mask` *(optional)* | integer | The collision mask. Defaults to [sm.physics.filter.default](../Game-Script-Environment/Static-Functions/sm.physics.md#filter) (Optional) |
| `world` *(optional)* | [World](../Game-Script-Environment/Userdata/World.md) | The world to perform the raycast in. (Optional) |
| `ignoreUuids` *(optional)* | table | A table of uuids \{[Uuid](../Game-Script-Environment/Userdata/Uuid.md), ...\} of [Shape](../Game-Script-Environment/Userdata/Shape.md), [Harvestable](../Game-Script-Environment/Userdata/Harvestable.md) or [Character](../Game-Script-Environment/Userdata/Character.md) type to be ignored. (Optional) |

**Returns:**

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