Search Unity

Confine 2D stopped working..?

Discussion in 'Cinemachine' started by Dedi6, Dec 16, 2020.

  1. Dedi6

    Dedi6

    Joined:
    Jan 20, 2019
    Posts:
    119
    Hello there!

    I have been using the Cinemachine Confiner for almost a year now.
    Recently I've been working on some other stuff, but today when I when testing the confiner just stopped working with no apparent reason.
    I updated to the latest Unity version, but it didn't help either.

    Because I use this for almost a year now and changed nothing, I have no idea as to what can cause this.

    Thanks in advance!
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    What version of Cinemachine are you using?
     
  3. Dedi6

    Dedi6

    Joined:
    Jan 20, 2019
    Posts:
    119
    The most recent one, 2.6.3.
    Upon further testing, It's not the Confiner is off - it's limiting my Cinemachine vcam, but not affecting the Main Camera as as it was doing before.
    So the CM vcam boundaries are as the Bounding Shape 2D, but the Main Camera just ignores that.
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    For the main camera to be controlled by your vcam, you need:
    - An active CinemachineBrain component on the main camera
    - The camera's Layer Mask must include the layer that the CM vcam is on
    - No other vcam is active unless it has a lower priority

    Can you check that those conditions are fulfilled?
     
  5. Dedi6

    Dedi6

    Joined:
    Jan 20, 2019
    Posts:
    119
    All check. As I said, I used this for almost a year now.

    Please look at the photos below:
    Unity1.png Unity2.png



    The first photo shows the Bounding Shape 2D.
    The second photo shows (in yellow) the cinemachine vcam. and in red the Main Camera.
    The Main camera is confined, but some areas are exposed which are not a part of the room. (the gap between the yellow and red)
     
  6. Dedi6

    Dedi6

    Joined:
    Jan 20, 2019
    Posts:
    119

    Ok. So for some odd reason only when the resolution is set to free aspect this happens.
    It didn't happen before, but that's another issue I need to solve.
     
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    The reason is that the CM Confiner does not change the ortho size of the camera. It's up to you to ensure that the ortho size is small enough to fit inside the bounding shape. When you changed the aspect, the horizontal size became larger than could fit inside the confining shape. I'm guessing that you never tried these sizes before so never noticed this behaviour until now.