I am attempting to make a field of view for the player of my game. The game has the player walk around an autogenerated dungeon. I have tried using Light2D and shadows to prevent the player from seeing what’s behind walls, but it would take far too long for me to save and load prefabs for the autogenerated levels, and manually make the ShadowCaster2D shapes. I also made a mesh of a field of view cone that uses Raycasts that detect where walls are. I also thought about applying a mask to this object, but I can’t find out how to dynamically change the mask to fit the mesh shape. I only need one of these options (or a third!) to work, and any help would be greatly appreciated!
Related topics
Topic | Replies | Views | Activity | |
---|---|---|---|---|
Field of view in a tile based 2d game | 2 | 2898 | September 9, 2015 | |
Is there a way to use a tilemap as a sprite mask? | 3 | 338 | May 17, 2025 | |
How to make a FoV to detect enemies | 1 | 282 | February 4, 2024 | |
Trouble with mesh generation for a field of view | 5 | 818 | March 5, 2023 | |
2D Tilemap shadows w/URP | 1 | 1211 | October 3, 2021 |