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
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
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
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
TraceGroupName
string
Filters the raycast to only include parts whose TraceGroupName property exactly matches this value (case-sensitive); parts with a different group name are excluded from the result. Leave this empty (the default) to disable group filtering and consider all parts regardless of their TraceGroupName.
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
Events
See also
WorldRootLast updated