Fog of War, clip through walls

Hi there, so I have made a basic fog of war system. I’m using a gird which Instantiates fog on every node and if a player hits the fog then it simply deactivates. However, now that I have done this I’m having an issue that I.m not sure on how to get around. I do not want the fog to clip through walls or anything like that and I’m unsure of how to do that? Any guidance would be amazing! Thank you!

In the picture below the blue square is the player and the black line is the wall. As you can see the player is behind the wall but the fog still goes away(this is because I’m just using void on trigger enter) but don’t know of a workaround… any help would be great!


thanks again!

Hi there, I actually solved this one by my self but in case for the future here is how I did this:
I simply used raycasting instead of OnTriggerEnter, if a ray hit the wall which was identified by layer masking then the fog would not disappear!