I want to make a raycast function that allows you to shoot a ray through bricks that have cancollide turned off. I've tried adding the bricks to the Ignorelist and the mouse TargetFilter, and in both cases, the ray is not accurate, does not fire at the spot that the mouse is pointing to, and ends up being at an offset angle. Help?
COMMUNITY QUESTION
How do I make a raycast function that ignores non-cancollided parts?
1 answer
Here's an example of how you can do this:
local ray = Ray.new(player.Lightning.WorldPosition.WorldPosition,player.HumanoidRootPart.CFrame.lookVector.unit*100)
local ignore = workspace.Noncollide:GetChildren();
table.insert(ignore,player)
local Part,Position = game.Workspace:FindPartOnRayWithIgnoreList(ray,ignore)
I hope this helped you.
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Adding the bricks to the ignorelist would work, it's not accurate because the mouse is focused on the non-collided part.
How would I make the mouse ignore the non-collided part? I already tried putting it on the TargetFilter.
heres what i would try, i would raycast from the camera to the mouse that continues on, having the parts with cancollide off in that ray's ignorelist too