Ray

The Ray functionality is used for casting rays through the game environment, enabling developers to perform tasks like detecting intersections with objects. This service is essential for gameplay mechanics such as shooting, line-of-sight calculations, and physics interactions.

Function

Description

findPart(Origin: Vector3, Direction: Vector3, FilterType: string, FilterDescendantsTable: {Instance}): (Instance, Vector3, Vector3)

Casts a ray from a specified origin in a given direction and checks for intersections with parts in the game. Requires 4 arguments: Origin (Vector3), Direction (Vector3), FilterType ("Whitelist" or "Blacklist") to specify the filter type, and FilterDescendantsTable (table of Instances) to filter which parts to check against. Returns the intersected Instance, the intersection Position (Vector3), and the surface Normal (Vector3) at the point of intersection.

Last updated