Collapse Sidebar



RaycastParams stores parameters for WorldRoot/Raycast|WorldRoot:Raycast() operations. The FilterDescendantsInstances property stores an array of objects to use as either a whitelist or blacklist based on the FilterType enum. If desired, the IgnoreWater property can be used to ignore Terrain water and the CollisionGroup property can specify a articles/Collision Filtering|collision group for the raycasting operation.

This object should not be confused with the similarly-named datatype/RaycastResult which is used to provide the results of a raycast.
Unlike most datatypes on Roblox, all the members of RaycastParams can be changed without creating a new object. When raycasting repeatedly, you should re-use the same object.


RaycastParams.new ( )

Creates a blank datatype/RaycastParams object. Unlike other datatype constructors, this constructor does not have any parameters, so you should set its properties appropriately.


array RaycastParams.FilterDescendantsInstances

An array of objects whose descendants will be used in filtering raycasting candidates.

RaycastFilterType RaycastParams.FilterType

Determines how the FilterDescendantsInstances list will be used, depending on the enum/RaycastFilterType provided.

  • Enum.RaycastFilterType.Whitelist — Only BasePart|BaseParts which are descendants of objects in the filter list will be considered in the raycast operation.
  • Enum.RaycastFilterType.Blacklist — Every BasePart in the game will be considered except those that are descendants of objects in the filter list.
bool RaycastParams.IgnoreWater

Determines whether the water material is considered when raycasting against Terrain.

string RaycastParams.CollisionGroup

Specifies a articles/Collision Filtering|collision group for the raycasting operation. Parts in collision groups that are set to not collide with this group will be ignored. If this property is omitted, the raycast will assume the Default collision group.