See Through Objects in Top Down Shooter

Hi, I am currently creating a top down shooter game, one of the problems I seem to run into in my game is not being able to see the player if he goes underneath a piece of geometry(plane, cube, etc)

I was looking to see if there was a way to have it to where the player went behind one of these objects that it makes the object see through

I did a little research, and from what I gathered I would have to use a Raycast between my player and the camera, something like

Cast raycast from camera to player, if it hits player, do nothing, if it hits object, set opacity to 50% or something.

Any help or suggestions would be greatly appreciated!

That’s exactly what you need to do. There are several ways of doing the transparency and which way you choose to do it depends on your project. If there are very few objects that you would have to make transparent then the easiest is to have 2 materials for each. You would then place a script on each object that sets the transparent material for a short period of time when told and then sets it back. Your raycast script would use GameObject.SendMessage() to tell it to reset the timer as long as the rays keep hitting it. No fuss, no muss. :slight_smile:

Hi If your still looking for a solution check our Asset as this is a custom made Asset for this use case. It can handle multi user multi buildings ( obstructions ) and is available for Standard URP and HDRP .

https://forum.unity.com/threads/rel...isible-within-buildings-std-urp-hdrp.1182130/

Asset:

WebGL Demo:
link text

Video:
link text

Greetings Toorican alt text