For my building system, I’ve been thinking that every time the mouse moves, just have a bunch of parts detect hits with mouse.Target. These parts will be transparent, but will they lag?
How many parts, exactly? If you used RunService and updated on RunService.Heartbeat, it should run fairly well, but it really depends on how many parts there are and the code you are using. You could also set the CanCollide property of the parts to false and do other things to help increase performance as well.
Edit: 2,000 to 10,000 is a lot of parts. You might have to consider using a different system or largely reducing the number of parts there are. (Maybe you could only load in the parts that are within a certain range of the player? That might be a bit complicated, though.)
I’m using this solution because I’m not sure how I would check if a raycast intersects with a certain position.
And to answer your first question, about 2000 - 10000 parts?
You can actually detect which part you intersect with (and returning the hit position), using
I know that, I’m saying I don’t know how to calculate certain points along the raycast.
Oops sorry didn’t see.
You can calculate all points along the raycast with the following formula:
[position of the ray hitpoint] - [ray direction] * [length modifier]
or
[origin of the ray] + [ray direction] * [length modifier]
With [length modifier] being a float that you choose yourself.
When you work with a grid and you need to find wether the ray goes through a certain grid position, you can check the ray at certain length modifiers based on the size of a grid tile, and modify each of the found ray positions to grid positions.