Feedback on my 2D Field Of View (Viewcone and Line Of Sight)

After 2 weeks of work, I finally coded my 2D FOV systems using Raycasting and wedge parts for the visual.
Demo:

As you can see from the video, the performance isn’t ideal, mainly caused by the rendering and unrender of the player character, which requires a lot of changes of position when looking rapidly.
I make the render and unrender part by editing the player root motor6D, this method keeps the player’s animations and (so far) my best performance-wise method.

If you have any other better method, please lemme know. Now I’m planning to use UI instead of the part for visuals for better performance.

3 Likes

Not bad, I really like this! I like how you made NPCS also unload. But won’t this look a bit weird if you are making a 2.5D game?

1 Like

Thank you for your feedback.

The 2D part is just the name that I gave to the feature, because not a lot of people know about Viewcone and Line of Sight stuff that often belong in a 2D game. My game is just a 3D with a top down camera.

Maybe you could have the npcs raycast towards the player to check line of sight instead?