Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It is quite simple, and as Jongware mention in the comments, you should use two lines of visibility.</p> <p>You should compute the lines of visibility from each "side" of the items in the picture. The origin of each visibility line can be approximated by computing the line from the center of the bomb and get the direction normal to that vector. Your two visibility points are then located one radius out from the center of the item in the normal and negative normal direction. This circle approximation might not represent all possible shapes very well, but is generally a good enough approximation for simple games (and your items look circular in the drawing).</p> <p>Java-isch pseudocode using 2D-vectors:</p> <pre><code>// bombCenter and itemCenter are 2D-vectors bombDirectionVector = bombCenter.minus(itemCenter); normal = bombDirectionVector.getNormal() // normal vector of length 1 viewPoint1 = itemCenter.plus(normal.times(itemRadius)); viewPoint2 = itemCenter.minus(normal.times(itemRadius)); // Check obstacle intersection with the lines from viewPoint{1,2} to bombCenter // ... </code></pre> <p>The visibility lines will then go from the points on the sides of each item to the bomb center. So, for each item, you check if the two visibility lines intersect either the same obstacle or two connected obstacles.</p> <p>There is no free open source C#-compatible engines I know of that does this, but the only part that can be a bit tricky is the obstacle intersection check. So if you just find something to help you with the intersection check, then the rest should be very straight forward to implement.</p> <p>I hope this helps, and let me know if anything is unclear and I'll clarify the answer accordingly.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload