Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

[SOLVED]Ray stops after it hits something?

So i'm shooting a ray from the camera to the Mouse position, it when it hits something it doesn't keep going like a normal ray, i tried everything to fix it, any help is greatly appreciated!

local newRay = Ray.new(Camera.CFrame.p,(Mouse.Hit.p - Camera.CFrame.p) * 1000)
local part,endpoint = game.Workspace:FindPartOnRay(newRay)

3 comments

0

You do realize that FindPartOnRay returns the first part the ray hit right?

0

*hits

0

If your question was solved, please mark the correct answer as such.

1 answer

✓ Accepted answer

Yes, the intersection test will end after the first intersection point is reached. If you'd like to find parts after the part you hit, you should consider casting another ray from the position that the ray hit, and so on and so forth.

This discussion is preserved as it was. New answers, comments, and votes are closed.