Find all locations where a ray/ raycast insects an object
I am trying to raycast through a funky shaped object, and I want to find each intersection between my object an my ray.
So far as I can tell, Raycast returns only the RaycastHit closest to the ray origin, and Raycast all does the same for multiple objects.
Things I have tried: 1. A forwards and backward raycast captures entry and exit points from an object, but misses times where the ray exists and re-enters the same object. 2. A recursive solution would cast a new ray from each intersection, but there is no guarantee that the new ray will not re-hit the same point. In my hands, this is leading to a "StackOverflow" error.
Any help would be appreciated!
Your answer
Follow this Question
Related Questions
Raycast Not Detecting Hit 0 Answers
Visualise Physics2D.BoxCastAll 1 Answer
Using Linecast with collider bounds 0 Answers
Linecast ignores obstacles. 0 Answers
How can I select 2 different objects using RayCastHit? 0 Answers