I’m looking at this Line of sight code and managed to get it to work with Phaser3. It works similar to the demo, so when you move a sprite with the mouse it will draw a yellow polygon for the visible area, see screenshot below.
However, I would like to get the negative or the opposite polygon, so the blue area in the example screenshot. Then I could make the polygon a black fill color, so that it will block any sprites that are outside of the visible area.
What is the best way to change this polygon?
Or is there a better way to do line-of-sight in Phaser?
Like is there a line-of-sight plug-in maybe?