Hi there! I’m working on a topdown game where the player has a line of sight. Certain walls (grey cubes) cut off the sight of the player (red cube) by checking the corners of all BoxCollider2D that overlay the yellow box, raycasting a line (cyan line) next to it to check if there’s something behind and finally connect all the points with a mesh.
Now everything is calculated correctly except when a raycast does not hit anything, like the most right cyan line. My question is, how to I find the point where a raycast exits the edge of the yellow box surrounding the player? I need it to complete the mesh’s shape. The yellow box is NOT a BoxCollider2D but just 4 points surrounding the player and connected by Debug.DrawLine()
Thank you for your time and I hope someone can crack this nut.

