# sm.physics.spherecast

Performs a spherical <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.spherecast(
    start,
    end,
    radius,
    ignore?,
    mask?,
    world?,
    ignoreUuids?
)
```

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

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. |
| `radius` | number | The radius of the sphere. |
| `ignore` *(optional)* | [Body](../Game-Script-Environment/Userdata/Body.md)\|[Shape](../Game-Script-Environment/Userdata/Shape.md)\|[Harvestable](../Game-Script-Environment/Userdata/Harvestable.md)\|[Character](../Game-Script-Environment/Userdata/Character.md)\|[AreaTrigger](../Game-Script-Environment/Userdata/AreaTrigger.md) | An object 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 cast 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. |
