Search Unity

Help with Rendering Based on Player Position

Discussion in 'Scripting' started by xenbiosis, Feb 2, 2011.

  1. xenbiosis

    xenbiosis

    Joined:
    Jan 28, 2011
    Posts:
    49
    Hey guys, I've been having a bit of trouble with this so I thought maybe I'd ask if anyone could help me out.

    Perspective: Top-down/3rd person

    I have a character moving from an outdoor environment to the interior of a building. I'm trying to figure out how to render every mesh from that particular building's roof as invisible so that you can see the entire structure from outside but only part of it from inside. Is there an ideal way of doing this? (JS if possible, I dont know much C# yet)

    I was thinking there would be a sort of area trigger that defines what is rendered and what is not depending on the position of your character. This is the easiest way of wrapping my brain around the concept. :D

    Thanks in advance for your input!
     
    Last edited: Feb 2, 2011
  2. bigmisterb

    bigmisterb

    Joined:
    Nov 6, 2010
    Posts:
    4,221
    cool idea. The core would be the ability to make something transparent. This I actually wrote a little code for in another thread.

    http://forum.unity3d.com/threads/76...-hidden-depending-on-the-character-s-location

    That is one way, however your best bet is to make the roof transparent when someone goes into a building.... Easy, make a big box (or mesh) trigger and use the OnTriggerEnter and OnTriggerExit functions. When the player enters the trigger, make the roof go transparent. When he leaves, make it go back solid.