# OverlapParams

## Overview

OverlapParams is a configuration object that manages the conditions needed when exploring part regions within the world.

Region exploration functions provided by WorldRoot reference this object to include or exclude specific objects through FilterDescendantsInstances and FilterType, and perform collision group-based exploration according to CollisionGroup settings.

Additionally, this data type allows changing configuration values without creating new objects, enabling reuse of a single OverlapParams repeatedly.

## Constructors

### new

Creates a new OverlapParams instance. No initial configuration values are included at creation, and properties must be specified individually according to the intended use.

#### Parameters

#### Return

| `OverlapParams` | The created OverlapParams. |
| --------------- | -------------------------- |

#### Code Samples

```lua
local Params = OverlapParams.new()
```

## Properties

### BruteForceAllSlow

`boolean`

When enabled, this option directly checks all parts in the world, ignoring part collision settings. This has very high computational cost and can cause performance degradation, so it should only be used for testing purposes.

#### Code Samples

```lua
local Params = OverlapParams.new()
Params.BruteForceAllSlow = true
```

### FilterDescendantsInstances

`Array`

This array specifies the reference objects to be included or excluded when performing exploration. 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 exploration targets.

#### Code Samples

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

### FilterType

`Enum.RaycastFilterType`

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

#### Code Samples

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

### MaxParts

`number`

Used to limit the number of parts that can be returned during region exploration.

When set to 0, all results are returned without count limitation.

#### Code Samples

```lua
local Params = OverlapParams.new()
Params.MaxParts = 50
```

### RespectCanCollide

`boolean`

When enabled, this option prioritizes the CanCollide property over CanQuery to determine whether parts should be checked during region exploration, providing results focused on potential collision.

#### Code Samples

```lua
local Params = OverlapParams.new()
Params.RespectCanCollide = false
```

## 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 exploration 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 exploration filter. |
| --------------- | ------------------------------------------------------------------------- |

#### Return

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

#### Code Samples

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

## Events

## See also

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.overdare.com/development/api-reference/datatype/overlapparams.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
