Object Bounds From a Specific View Point/Direction

SCENARIO:
I am trying to simulate wind “shadow” effects on a sailboat (known as “blanketing”).
I have a “sail” object on each boat.
If the sail on boat A is in the wind “shadow” of boat B then boat A will move slower.

My plan was to have a box collider that extends from the boat and away from the boat in the direction that the wind is blowing (just a vector).
If another boat’s “sails” are within that collider they are in wind shadow and have reduced speed.

My problem is that the width of the collider will be different depending on the angle of the wind relative to the sail. I need to figure out how wide to make the collider.

QUESTION:
So, how can I determine the bounds of the sail as “seen” from the wind direction?
This only needs to be determined in the X/Z plane (parallel to the water surface).

Thanks.

whisp, Thanks for the reply.
I thought of using raycasts, and that may be where I end up, but there are some nuances.
I don’t want the shadow to be all or nothing, I want partial shadowing as well where only part of the sail is in the wind shadow of another boat.
Also, the boat may be heeling (leaning/rotated away from the wind) so it might be hard to hit the sail itself with raycasts.

Expanding on my initial idea: I would have several gameobjects (Shadow_GOs) along the bottom edge of the sail that would move with the sail as it rotates. I had hoped to test how many of the Shadow_GOs are in the wind “shadow” collider of any other boat and reduce the speed accordingly.

Another idea: Add a very thin box collider to the sail (sail_collider), standing vertically. Raycast from the Shadow_GOs of other boats in the direction the wind is coming from. If they hit the sail_collider of another boat then those Shadow_GOs are in the wind shadow. The total # of Shadow_GOs in the wind shadow of other boats reduces the speed appropriately.

Sorry, if this is confusing, I’m rushed writing this.

I think this talk gives the core of what you are looking for: Unite 2015 - A Little Math for Your Big Ideas - YouTube

I agree with the raycast option. You can get the sail corners easily enough. Raycast from them in the direction of the wind. If you have 4 corners and 3 of the 4 raycasts hit a sale, simple enough to call that 3/4ths (75%) blocked. However, if you wanted higher resolution, then it’s a simple matter to get a distribution of edge points with some Lerping, and either math or more lerping to get points on the sail surface. Cast from those as well for a more precise calculation of effect. How high a resolution is entirely up to you, Lerp 0.5 for 5 more points, 11% steps of resolution, 0.33 for 12 more points, 6.25% steps of resolution. I doubt I’d go further, but you could for sure.

This also has some side advantages, such as also giving you the distance to the object creating the wind shadow, which should be important to the math (I love sailing physics). A bigger one might be that it could work with anything at all up wind. A big ship, a smaller ship’s sails, an island, a cliff, a lighthouse on a sea rock, even other sails on the same ship, etc…

To save on processing power, I’d probably just start with the corners, and halt further raycasting if none of those hit.

To specifically answer your question about the bounds of an object as seen from a given angle, there are similar processes here.

  1. get the corner vertices
  2. get a plane defined from the normal of the wind direction
  3. project each vertice as a vector onto the ‘wind plane’
    the resulting vectors should be the shadow profile of the sail in the direction of the wind.

I’d have to experiment with this a bunch to make sure i got the exact method usages right, but I know the answer is in this rough concept.