I’m making an overhead view turn based strategy game. When the player tells a unit to attack a target, the unit should check LOS to the target. However, I don’t want to just check the center point. I want to calculate a cover rating based on how much of the target (or rather, its collider) is visible. How can I get the “cross section” of the collider to send the raycasts to?
In the end, the player isn't going to notice how the "partial cover" is calculated, so you can sort of "fake" it, as I'm guessing it's not necessary to get an exact amount. You could simply trace rays to different parts of the target unit; for instance, trace a LOS to the head, torso, and legs and calculate the partial cover based on how many rays made their mark and how many hit something else.