It would be great if we could get a raycasting method with a callback :]
The callback would return a boolean:
If true then the search will end and that part will be returned.
If false then the search will continue and the part will be ignored.
Example usage
local function IsPartValid(part)
local isValid = part.CanCollide
print("Checking:", part, isValid)
return part.CanCollide
end
print("Starting search...")
local part, position = workspace:FindPartOnRayWithCallback(bulletPathRay, isPartValid)
print("Returned:", part)
Example output
> Starting search...
> Checking: LightingEffect false
> Checking: LightingEffect false
> Checking: Particle false
> Checking: Wall true
> Returned: Wall
Also, it would be nice if we could get a Ray.new overload that accepted 6 numbers rather than 2 Vector3’s, for performance reasons:
Ray.new(originX, originY, originZ, directionX, directionY, directionZ)
This would make raycasting much more powerful than it already is :imagine: