RaycastParams
Overview
Description
The RaycastParams
object is used to configure the behavior and filtering of raycasting functions in Lua. It allows developers to specify options such as ignoring specific objects, setting collision groups, and filtering based on custom rules.
Properties
FilterDescendantsInstances
array
Defines a list of instances whose descendants should be ignored or included by the raycast, depending on the FilterType
property.
Code Samples
FilterType
Enum.RaycastFilterType
Specifies whether the instances in FilterDescendantsInstances
should be included or excluded. Valid values are Whitelist
or Blacklist
.
Code Samples
IgnoreWater
boolean
Determines whether the raycast should ignore water. If set to true
, water will not block or interact with the ray.
Code Samples
CollisionGroup
string
Specifies the collision group for the raycast. This allows filtering based on predefined collision group rules.
Code Samples
RespectCanCollide
boolean
Indicates whether the raycast should respect the CanCollide
property of objects. If false
, non-collidable objects can still interact with the ray.
Code Samples
BruteForceAllSlow
boolean
If set to true
, all objects in the workspace will be checked during the raycast, which can be computationally expensive. This is generally used for debugging or exhaustive collision checks.
Code Samples
Constructors
new
Creates a new RaycastParams
object with default values.
Parameters
Return
RaycastParams
A new RaycastParams.
Code Samples
Methods
AddToFilter
Adds one or more instances to the FilterDescendantsInstances
property.
Parameters
Instance|array
InValue
The instance(s) to add to the filter.
Return
RaycastParams
Returns the updated `RaycastParams` object.
Code Samples
Last updated