If it hit more than 1 part, then query again at halve size
If it hit more than 1 part, then query again at 1/4. Otherwise query 3/4
Repeat step 3 with smaller and smaller steps, stop when you hit 1 part or if the step size is below a certain amount (so it doesn’t repeat forever)
Since :GetPartBoundsInRadius() uses bounds instead of their actual volume, you could use a module to get the area that the 2 parts overlap, then do a simple distance check with that. Except that I don’t have a module for that.
ive been thinking of a little simpler solution to my problem im just not sure how this would be performance-wise as im running it every renderstep. im also wondering what the simplest solution is to this problem, as the possible solutions other posted do exceed my level of math/scripting
here im trying to raycast around the mouse.hit.p in a 3d space
now i came up w this but im not sure again if theres a better method of doing this
this would save me performance compared to the old method tho, just not sure how to get the right raycast directions and origins
Didnt look on that. Thx for telling that. But are you sure raycasting in every direction is the best way. Considering the fact that there is not gonna be a part in every direction, why not raycast from the centre to the other parts centre. Its gonna reduce alot of stuff to raycast upon.
Raycasting is a better solution, but still does not work. Unless you can come up with a raycasting algorithm that works 100% of the time, I’m sticking by my solution.
Here’s an example where raycasting from point to part origin fails. The red line represents the the raycast and the blue line represents the actual distance. The larger part would be marked as farther away, by the raycasting method, even though it is not.