RaycastParams
The RaycastParams data type stores parameters for WorldRoot:Raycast() operations. The FilterDescendantsInstances property stores an array of objects to use as either an inclusion or exclusion list based on the RaycastParams.FilterType enum. If desired, the RaycastParams.IgnoreWater property can be used to ignore Terrain water, and the RaycastParams.CollisionGroup property can specify a collision group for the raycasting operation.
This object is different from the similarly named RaycastResult which provides the results of a raycast.
Unlike most data types in Luau, you can change all of the members of RaycastParams without creating a new object, allowing you to reuse the same object repeatedly.
Summary
Constructors
- new()
Properties
An array of objects whose descendants are used in filtering raycasting candidates.
Determines how the FilterDescendantsInstances array is used.
Determines whether the water material is considered when raycasting against Terrain.
The collision group used for the operation.
Determines whether the raycast operation considers a part's CanCollide property value over its CanQuery value.
When enabled, the query will ignore all part collision properties and perform a brute-force check on every part.
Methods
Adds the instances provided to FilterDescendantsInstances.
Constructors
new
Properties
FilterDescendantsInstances
An array of objects whose descendants are used in filtering raycasting candidates.
FilterType
Determines how the FilterDescendantsInstances array is used, depending on the Enum.RaycastFilterType provided.
CollisionGroup
Specifies a collision group for the raycasting operation. Parts in collision groups that are set to not collide with this group are ignored. If this property is omitted, the raycast assumes the Default collision group.
RespectCanCollide
This property, if true, makes the raycast operation use an intersected part's CanCollide value in favor of its CanQuery value when determining whether that part is included in the RaycastResult.
BruteForceAllSlow
When enabled, the query will ignore all part collision properties and perform a brute-force check on every part. This will negatively impact performance and should not be used in live experiences.
Methods
AddToFilter
For efficiency and simplicity, this method is the preferred way to add instances to the filter. It has the additional advantage that it allows FilterDescendantsInstances to be updated from a parallel context.