semi-transparent objects when avatar is behind them

Hi all,

I’m doing an adventure-game where the camera hovers behind the players avatar (think Diablo II).

The trouble is that sometimes the avatar disappears behind buildings, trees, etc, which is a bit confusing. So I figured that one way to solve this was to make any object between the avatar and the camera semi-transparent, which they also did in Diablo II as far as I can remember.

Does anyone have a script/shader/magic wand/dog that can do this ? 8)

… Or maybe just a general idea how to do this?

Any/all help greatly appreciated!

download the third person example project from here:
http://unity3d.com/examples/

It contains a script called FadeOutLineOfSight.js which does exactly this and has a lot of nice tunable properties.

Oops! Joachim beat me to it. I didn’t know there was a nice script for doing that already made.

well joachim, you just have an answer for everything, don’t you :slight_smile:

no seriously, thanks a bunch - i’ll give it a try and complain some more if I can’t get it to work

I’m trying to figure out the script that you recommended, but I can’t seem to make it work.

I’ve copied the script into my project and added it to my avatar-camera. Then I dragged my avatars transform onto the target variable and tweaked the different variables, but so far no reaction whatsoever…I can’t get it to show up at all :-/

Any bright ideas ? And what’s the Layer Mask-variable for?

NEVERMIND, I just got it to work - just had to set the Layer Mask variable to Everything to make it work. Doh.