LegacyRaycast - Use old raycast functions in a separate thread

About

LegacyRaycast is a module that imitates old raycasting functions such as FindPartOnRay with new raycasting methods

i mainly made this module for myself to use old raycasting functions in a separate thread
please tell me if i forgot something or if you encountered a bug

How to use

this works like the original functions except its limited to workspace (for now)
example script:

local lray=require(game.ReplicatedStorage.LegacyRaycast);
local part,pos,normal,material=lray:FindPartOnRay(Ray.new());

here are all the functions

lray:FindPartOnRay(ray, ignoreDescendantsInstance, terrainCellsAreCubes, ignoreWater)
lray:FindPartOnRayWithIgnoreList(ray, ignoreDescendantsTable, terrainCellsAreCubes, ignoreWater)
lray:FindPartOnRayWithWhitelist(ray, whitelistDescendantsTable, ignoreWater)

all of these will return the same tuple :

the instance that the ray touched (BasePart or Terrain)
the intersection point (Vector3)
surface normal at the point of intersection (Vector3)
the material of the instance that was touched (Material)

3 Likes