Search Unity

How can I decrease walls opacity when character approaches. (Isometric game)

Discussion in 'World Building' started by SthealtDevil, Oct 7, 2018.

  1. SthealtDevil

    SthealtDevil

    Joined:
    Oct 7, 2018
    Posts:
    1
    Hi, first than anything, I'm mexican so I'm sorry if I write something wrong. I'm new at the games development and I'm trying to create an isometric game, but I don't know how can I decrease opacity of walls when my character approaches to see what is he doing. I don't know if is with a script or a new component on the walls, so I will be very greatful if someone can help me or pass one link with an explanation for this c:
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Yes, it's a script (which is a type of component) which you will probably attach to the player, not the walls. It should cast a ray (see Physics.Raycast) between the player and the camera. If it hits anything, then it should adjust the opacity of the thing you hit. You do that by setting the shader on the walls to Fade (rather than Opaque), and then just assigning a color to the material with an alpha less than 1.
     
    Adam-Bailey likes this.