- Home /
Alpha mask(?) around player to see through walls
I'm making a stealth game of sorts and I'm wondering if there's anyway to use some sort of mask to allow me to see through some tagged walls so I can still see the character. E.g. A mockup I made in Photoshop
So like an image overlay which has a soft-edged circle in the middle which is where the mask is applied, so you can see through to where the character is but obviously it only affects tagged objects like the walls and not the floor.
Any ideas how I'd go about doing this?
Answer by fafase · Mar 26, 2015 at 12:29 PM
Most simple way I can think of without getting into shader would be to use raycast from camera to player and anything being hit gets its alpha to 0.5 (obviously not all object maybe).
You could use layer to set environment so that when hit by the raycast they turn semi-transparent.
Yeah I was looking at doing it this way but it makes whole walls transparent, opposed to just having it as a radius around the player.
So more complex solution is there: http://forum.unity3d.com/threads/projecting-a-hole.35808/
the shader is actually there http://wiki.unity3d.com/index.php?title=Depth$$anonymous$$ask