RayCasting: Can You Ignore Something Based On A Part's Name?

I was wondering if it was possible to ignore something that the ray hits based on its name? Like if you cast a ray in front of a player, and then it hits a part, it would check the part’s name, and if it’s a part that I don’t want to ignore it will keep on going. Sorry if I am not providing enough info, I’m bad at explaining and new to raycasting.

1 Like

In my opinion, you can use raycastparams and then put the parts you want to ignore in a table.
then choose whitelist in filterType.
I recommend checking youtube or developer hub to understand more. Hope this helps! :slight_smile:

1 Like

it is possible, due to me doing this before with Swordphin’s Raycast Module i totally forgot how it works though, you can find more info about it on his github

cast multiple rays while true do until the hit is not the name.

Not directly, no. I also don’t recommend doing multiple raycasts, it will get complicated.

I would either:

  • Use a CollisionGroup to filter your parts with RaycastParam.CollisionGroup
  • Use a whitelist of parts that you care about, if the number is small
  • Group the blacklisted parts in a single model and just add that model to the blacklist.
3 Likes