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

local RaycastParams = RaycastParams.new()

Properties

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

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

IgnoreWater

boolean

Currently not supported.

Code Samples

CollisionGroup

string

Defines which collision group rules the raycast will operate based on. Specified collision groups and parts that are mutual collision is not allowed are automatically excluded from raycast targets. If not configured separately, the default collision group is used to process the raycast.

Code Samples

RespectCanCollide

boolean

Currently not supported.

Code Samples

BruteForceAllSlow

boolean

Currently not supported.

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

Instance|array 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

See also

WorldRootchevron-right

Last updated