Home > Software design >  How Can i Hide an Object in The Shadows Without Making the Shadows Completely Dark (Unity)
How Can i Hide an Object in The Shadows Without Making the Shadows Completely Dark (Unity)

Time:07-01

i had problem with Unity Shadow Caster, in my game i wanted to create a field of view for players that when players are behind a wall, they become invisible to others that are on the other side of the wall, just like in the among us game. i achieved this with the unity Shadow caster 2d but the problem is i have to make the shadows intensity to the maximum, i want to make the shadows half intensity and also have the players be invisible when in the shadows, i would be really Glad if someone can help me with this issue.

also if there is any other way to make this field of View without 2d Lighting and Shadows i would be really glad to know about it.

enter image description here

CodePudding user response:

About the shadows in unity2d, they are pretty buggy and you won't get your desired results from them, as later down the line you may encounter issues where there would be no going back, Here's a link for a cone vision-based system you can go with this approach this is more similar to among US https://youtu.be/CSeUMTaNFYk

I would recommend using a raycast system to detect the visible player in the range, as you would be using colliders for walls and other objects you can perform a ray cast check and maintain a list of visible players, that way later down the line is you want to build upon this system you would have access to all those visible players and then you can disable the render component from the non-visible player.

  • Related