OverlapParams

Overview

Description

The OverlapParams class is used to configure parameters for spatial computation methods, like overlap or vicinity checking functions. It allows developers to specify filtering criteria, collision properties, and other parameters to refine the results of spatial queries.


Properties

MaxParts

number Defines the maximum number of parts (or objects) that the overlap operation should return. Setting a limit ensures performance optimization by avoiding the return of an unnecessary large number of results.

Code Samples

local params = OverlapParams.new()
params.MaxParts = 50

BruteForceAllSlow

boolean Determines whether or not the overlap operation will run with a "brute force" approach, which may be significantly slower but ensures it evaluates all results.

Code Samples

local params = OverlapParams.new()
params.BruteForceAllSlow = true

RespectCanCollide

boolean Specifies whether parts that have the CanCollide property set to false should be ignored in the overlap operation.

Code Samples

local params = OverlapParams.new()
params.RespectCanCollide = false

CollisionGroup

string Filters the overlap results by the specified collision group. Only parts belonging to the given collision group will be considered in the computation.

Code Samples

local params = OverlapParams.new()
params.CollisionGroup = "MyCollisionGroup"

FilterDescendantsInstances

array An array of instances to include or exclude during the overlap computation. These instances influence the filtering settings based on the RaycastFilterType.

Code Samples

local params = OverlapParams.new()
params.FilterDescendantsInstances = {workspace.Part1, workspace.Part2}

RaycastFilterType

Enum.RaycastFilterType Defines the filtering behavior used in combination with FilterDescendantsInstances. Valid enumeration values include Blacklist and Whitelist.

Code Samples

local params = OverlapParams.new()
params.RaycastFilterType = Enum.RaycastFilterType.Whitelist

Constructors

new

Creates a new instance of the OverlapParams class, which can be configured with the desired properties.

Code Samples

local params = OverlapParams.new()
params.MaxParts = 100
params.BruteForceAllSlow = false

Methods

AddToFilter

Adds additional instances (or an array of instances) into the filtering list for overlap computations. The new instances are appended to the FilterDescendantsInstances.

Parameters

Name
Description

arrayInValue

The instance or array of instances to add to the filter.

Return

Return Type
Description

OverlapParams

Returns the modified OverlapParams object for method chaining.

Code Samples

local params = OverlapParams.new()
params:AddToFilter(workspace.Part3)
params:AddToFilter({workspace.Part4, workspace.Part5})

Last updated