Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Disappearing GameObjects in Cinemachine-controlled cameras

Discussion in 'Cinemachine' started by Screenhog, Sep 28, 2017.

  1. Screenhog

    Screenhog

    Joined:
    Jul 2, 2009
    Posts:
    496
    I've been starting to learn Cinemachine, and I've encountered a strange bug. Within a camera that is controlled by cinemachine, an animated GameObject will sometimes disappear. For instance, it'll walk by the camera and then be invisible for a few frames before becoming visible again.

    Here are the things I know.
    • The frames where it disappears are somewhat consistent. It's usually the same frames that disappear when I'm travelling forward in time, but when I scrub backwards, those frames magically appear and others disappear.
    • It happens in Edit Mode and Play Mode.
    • It only seems to affect objects in motion. Other animated objects or still objects in the scene are unaffected. It doesn't matter whether or not the camera is following the moving object.
    • When I change my field of view to be wider, the character does not disappear any more. (It makes me think it's a view frustum issue, but the character stays in the middle of the screen at all times.)
    • The disappearing frames are usually when the character is closest to the camera.
    Should I try reporting this to Unity? Has anyone else encountered this?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    3,687
    @Screenhog Sounds like a near clipping plane that's too far. Can you post an image of the vcam inspector?
     
    Last edited: Sep 29, 2017
  3. Screenhog

    Screenhog

    Joined:
    Jul 2, 2009
    Posts:
    496
    I'll try to get something tomorrow. Unity just crashed with a maxCallback bug (unrelated to Cinemachine). But I was able to make the character disappear even from far away, as long as the character was near the edge of the screen. I'm pretty sure I must be setting something up wrong.
     
  4. Screenhog

    Screenhog

    Joined:
    Jul 2, 2009
    Posts:
    496
    All right, I've captured it here. As you can see on the ground, there are supposed to be two characters in this shot, but only one character is actually showing up. (Both shadows can be seen on the ground.) The Near Clip Plane of this camera is set to 0.1, and the characters themselves are about 2 units tall, so it doesn't seem like it should be that.
     

    Attached Files:

  5. IBuro

    IBuro

    Joined:
    Jul 7, 2017
    Posts:
    3
    Hi Screenhog!

    Perhaps it's a little too late, but I'm actually getting this same issue.

    Reading your comments, I came to think that the problem perhaps is that the object initiates it's movement outside of the camera frustum, so the camera settings culls such object.
    It's clearly a strange bug, and it shouldn't happen, but changing some of the culling options might be a workaround.
     
  6. ErnestoBananez

    ErnestoBananez

    Joined:
    Sep 23, 2014
    Posts:
    16
    Again, probably too late, but I had the same issue with the 2D version of the Cinemachine camera. For me, changing the Orthographic Size ever so slightly (adding .2) on the Cinemachine camera script fixes the issue completely.
     
  7. NorthStar79

    NorthStar79

    Joined:
    May 8, 2015
    Posts:
    83
    Just encountered the same problem. this bug is still a thing in Unity 2018.3.0b7 and Cinemachine 2.2.7

    Here my observations about the bug and how I work around it.
    I guess Cinemachine is using some kind of hierarchical culling, means if "the parent" is outside of frustum "children" are culled too, no matter what. Probably for performance reasons. But this leads to a "bug" that if "parent" stays still and "child" moves and camera follows child's transform. The easiest workaround of this is just un-parenting that game object. but I must say that this may be not an option all the times. So at least there should be an option to disable hierarchical culling completely or just for some gameobjects.

    I hope this helps people.
     
unityunity