Search Unity

Weird Scene rendering question

Discussion in 'General Graphics' started by jonathan_srcy, Sep 24, 2017.

  1. jonathan_srcy

    jonathan_srcy

    Joined:
    Sep 18, 2017
    Posts:
    3
    I'm new to Unity and I'm now trying to create a top down shooting game in unity. I made a script where the camera will trace the player movement and abit of the mouse position as well, the camera is in orthographic view. However I'm bothered by this weird thing where the game shows part of the building like the picture shown below:
    upload_2017-9-24_22-50-38.png
    Where when I move my mouse cursor down it can show the whole building:
    upload_2017-9-24_22-52-18.png
    is there anyway I can fix that as I don't want the building the render partly.
    Thanks and sorry if this is a stupid question.
     

    Attached Files:

  2. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,913
    It's the near plane of the camera cutting it.

    Cameras can only see a certain distance, and only start seeing from a certain distance. Change it from 0.3 to something smaller, or you can move the camera further away.
     
    jonathan_srcy and AcidArrow like this.
  3. jonathan_srcy

    jonathan_srcy

    Joined:
    Sep 18, 2017
    Posts:
    3
    I tried changing the near clipping planes to a smaller number but its still the same, sorry if I didn't make myself clear. I know that the building will 'despawn' if I move too far away from it but why does it start cutting at the middle of building while still displaying the edges like the pics below. Is there anyway I can change this behavior of disappearing where the building start disappearing from the part closest to the bottom of screen.
    upload_2017-9-25_14-47-43.png
     
  4. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    Just move the camera back a little. A camera only renders what's inside the frustum, which in the case of an orthographic camera is just a box.
    Code (csharp):
    1.  
    2. camera.transform.position -= 10.0f * camera.transform.forward;
    3.  
     
    jonathan_srcy and NicBischoff like this.
  5. jonathan_srcy

    jonathan_srcy

    Joined:
    Sep 18, 2017
    Posts:
    3
    This solves the problem completely! Thanks very much guys:D