Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

semi-transparent objects when avatar is behind them

Discussion in 'Scripting' started by peckinpah, Oct 6, 2006.

  1. peckinpah

    peckinpah

    Joined:
    Mar 15, 2006
    Posts:
    71
    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!
     
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    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.
     
  3. forestjohnson

    forestjohnson

    Joined:
    Oct 1, 2005
    Posts:
    1,370
    Oops! Joachim beat me to it. I didn't know there was a nice script for doing that already made.
     
  4. peckinpah

    peckinpah

    Joined:
    Mar 15, 2006
    Posts:
    71
    well joachim, you just have an answer for everything, don't you :)

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

    peckinpah

    Joined:
    Mar 15, 2006
    Posts:
    71
    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?
     
  6. peckinpah

    peckinpah

    Joined:
    Mar 15, 2006
    Posts:
    71
    NEVERMIND, I just got it to work - just had to set the Layer Mask variable to Everything to make it work. Doh.