Search Unity

Resolved Game objects vanished from the camera view. How to make them reappear?

Discussion in '2D' started by Ryan1Cooper, Apr 20, 2023.

  1. Ryan1Cooper

    Ryan1Cooper

    Joined:
    Apr 20, 2023
    Posts:
    7
    Hello Community!
    I'm new here, just installed Unity smth like 20 hours ago and trying getting started. I was using
    tutorial to learn basics of Unity2D when my game objects suddenly failed to appear on camera view. It worked just fine just a moment ago and then - wham! - and the bird just does not appear on camera. I created second game object to test if just messed up the first but not - it also failed to appear on the camera view.

    About me if i'll help to explain something:
    I'm currently studding on Applied Mathematics and Informatics degree in my uni so i decently know linear algebra and a bit of physics. My main programming language is c++ and I know basics of Java.

    That how the scene looks rn:
    upload_2023-4-20_16-10-59.png

    That how it looks in the game:
    upload_2023-4-20_16-12-20.png
     
  2. Ryan1Cooper

    Ryan1Cooper

    Joined:
    Apr 20, 2023
    Posts:
    7
    I actually have found solution relatively quickly - it was z-position of the camera. Turns out if an object have same position on the axis as the camera - the camera wont see it. Most likely I changed z-coordinate of the camera when I after dragging it around the scene wanned to return it to the origin so I changed the third coordinate unconsciously to zero too.
     
    icauroboros likes this.
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    More technically, if you place an object outside of the camera frustum it won't be seen. That's how cameras work.

    By default the near clip plane is 0.3f and far clip is 1000f (last I checked).

    If you put the object ON the camera's Z position, then it would be invisible unless you moved the near clip plane to be less than zero, which you can actually do if you like, but generally would not do, not only because it might be confusing, but it also might interfere with other systems that derive information from these volumes.

    Since it's just math and one giant linear number space, you can actually make your camera see "behind" itself if it is an orthographic camera: the frustum will simply be behind the camera.

    Try it for yourself:

    Screen Shot 2023-04-20 at 10.43.41 AM.png
     
    DragonCoder likes this.
  4. Ryan1Cooper

    Ryan1Cooper

    Joined:
    Apr 20, 2023
    Posts:
    7
    Wow! That's very interesting indeed. Thank you very much for this information!