Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to make a mesh renderer invisible past a certain point

Discussion in 'Scripting' started by JustASHadow, Oct 28, 2014.

  1. JustASHadow

    JustASHadow

    Joined:
    Oct 28, 2014
    Posts:
    7
    So, I'm working on an fast paced stealth game and I want to highlight the areas that the enemies can see i.e. make their trigger colliders have a mesh renderer. The problem is that I don't want to make said renderers pop trough walls and such. Basically I need to make the renderer behave like a light.
    I was thinking of casting a light from each enemy and making a shader that is visible only when hit by that light, but I was wondering if there's an easier way.
     
  2. MysterySoftware

    MysterySoftware

    Joined:
    Sep 18, 2014
    Posts:
    46
    You should use raycasts for collision checking and use the line renderer to draw the areas in which your enemy would be able to see you.
     
  3. JustASHadow

    JustASHadow

    Joined:
    Oct 28, 2014
    Posts:
    7
    I'll play around with that idea tomorrow. Thanks for the response :D