> For the complete documentation index, see [llms.txt](https://docs.overdare.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.overdare.com/development/api-reference/datatype/raycastparams.md).

# RaycastParams

## Overview

RaycastParams is a configuration data type that defines the conditions and filters to be applied when executing a Raycast. It is used when calling WorldRoot:Raycast and allows fine control over which objects to be included or excluded from collision targets and which collision group criteria to use for testing.

## Constructors

### new

Creates a new RaycastParams instance. No initial configuration values are included at creation, and properties such as filters and collision groups to be used for raycasting must be specified individually according to the intended use.

#### Parameters

#### Return

| `RaycastParams` | The created RaycastParams. |
| --------------- | -------------------------- |

#### Code Samples

```lua
local RaycastParams = RaycastParams.new()
```

## Properties

### BruteForceAllSlow

`boolean`

Currently not supported.

#### Code Samples

### FilterDescendantsInstances

`Array`

This array specifies the reference objects to be included or excluded when performing raycast. All child elements of each object registered in the array are considered together, and depending on the FilterType setting, they are either included in or ignored as raycast collision targets.

#### Code Samples

```lua
local RaycastParams = RaycastParams.new()
RaycastParams.FilterDescendantsInstances =
{
    Workspace.Part1,
    Workspace.Part2
}
```

### FilterType

`Enum.RaycastFilterType`

Specifies whether objects included in FilterDescendantsInstances should be included in or excluded from raycast targets. Depending on the selected RaycastFilterType enum value, the array is applied as a criterion to limit collision check candidates.

#### Code Samples

```lua
local RaycastParams = RaycastParams.new()
RaycastParams.FilterType = Enum.RaycastFilterType.Exclude
```

### FindInitialOverlaps

`boolean`

Sets whether objects that are already overlapping at the start of the raycast should also be included in the results.

#### Code Samples

### IgnoreWater

`boolean`

Currently not supported.

#### Code Samples

### RespectCanCollide

`boolean`

Currently not supported.

#### Code Samples

### TraceComplex

`boolean`

Sets whether to perform a precise raycast using complex collision meshes.

#### Code Samples

## Methods

### AddToFilter

Adds the specified instances to the FilterDescendantsInstances list.

This is simpler and more efficient than directly modifying the filter array, allowing safer and more consistent management of raycast filter configuration. This method is also suitable for incrementally accumulating filter settings.

#### Parameters

| `Value` InValue | The instance or array of instances to be added to the raycast filter. |
| --------------- | --------------------------------------------------------------------- |

#### Return

| `RaycastParams` | Returns the RaycastParams object with the updated filter. |
| --------------- | --------------------------------------------------------- |

#### Code Samples

```lua
local RaycastParams = RaycastParams.new()
RaycastParams:AddToFilter(Workspace.Part1)
RaycastParams:AddToFilter({ Workspace.Part2, Workspace.Part3 })
```

## Events

## See also

{% content-ref url="/pages/A9RxgYKTmNNgDRmjtQwe" %}
[WorldRoot](/development/api-reference/classes/worldroot.md)
{% endcontent-ref %}
