FindPartOnRay (Method)

FindPartOnRay( Ray ray, Instance ignoreDescendentsInstance, Bool TerrainCellsAreCubes )
Returns BasePart object, Vector3 position
Description: Returns the first part that intersects with a ray.
Member of: Workspace



Usage

  • The length of the direction vector is important - parts further away than its length will not be tested.
  • The length of the direction vector cannot be more than 1000 studs.
  • Any parts that are descendants of ignoreDescendantsInstance will be ignored.
  • If the ray does not intersect a part, the return values will be nil and the point at the end of the ray, respectively.
  • if TerrainCellsAreCubes, it treats all terrain cells as cubes regardless of their shape and orientation.

See Also