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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Preventing a camear from seeing inside a Model

Discussion in 'General Graphics' started by Shadowing, May 25, 2015.

  1. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,628
    I'm making a flying game and at the beginning of the game it shows the ship coming out from the camera. The issue with this is the camera sees through the ship model. Is there anyway to keep the camera only seeing the out side of the model?

    Been wondering about this.
     
  2. KingMatthew

    KingMatthew

    Joined:
    Jul 7, 2013
    Posts:
    166
    there are camera scripts that follow objects with collisions. It may be the default one but if it isn't just google it.
     
  3. AlexBM

    AlexBM

    Joined:
    Mar 26, 2015
    Posts:
    16
    I think, the simplest solution is to make sure your camera is outside of the model geometry and tweak near clip plane if required. On contrary, it's not exactly clear what you are expecting to see on the screen while rendering model inside out.
     
    Last edited: May 26, 2015
  4. kburkhart84

    kburkhart84

    Joined:
    Apr 28, 2012
    Posts:
    910
    If your camera never goes inside of the object afterwards, then the easiest solution is to just make sure it starts outside in the first place in the editor.

    If this is not the case, you will need to code something to either prevent it from going inside of it, or something to modify the object if it gets too close. Different games do different things. Many games just make anything too close to the camera semi-transparent(or even fully). Other games make the camera an entity in the world, that can be stopped by walls, etc... It all depends on the game, but like I said before...if your camera is fine during the game and only gives this problem at the very start, than in the Unity editor, move the thing outside of the object and don't mess with the other stuff unless you have to.
     
  5. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,628
    thanks for the reply guys. Maybe I should just show a different camera angle at the beginning like have the camera do a half circle move around the ship at the start.
     
  6. Zicandar

    Zicandar

    Joined:
    Feb 10, 2014
    Posts:
    388
    You CAN use stencil buffer and such to fully filter it out, but at some point you WOULD need to make it visible, either by "popping" it in, or having it transparent to start with and then fade in nicely.
    However I agree with the others that having a camera starting IN a object doesn't sound like a good idea...
     
  7. kburkhart84

    kburkhart84

    Joined:
    Apr 28, 2012
    Posts:
    910
    Can't you just directly position the camera where you want it? It might be OK do do a half circle or something, but does it really add anything? Just put the camera right where you want it from the start, and let your scripts maintain it there as the player moves.
     
  8. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,628
    Well I mean I wanted the camera to go through it but not lol. Its just for show at the start of the game. Here is a video showing what Im talking about. I just realized though that this looks just as good if I just have the camera further above the craft so the craft comes out under the camera instead of behind.