Search Unity

Cinemachine multiple confiners

Discussion in 'Cinemachine' started by mattimus, Mar 11, 2022.

  1. mattimus

    mattimus

    Joined:
    Mar 8, 2008
    Posts:
    576
    I'm trying to create complex camera bounds with Cinemachine using Cinemachine Confiner in 2D mode and a Polygon2D collider. These bounds have convex and concave corners. The black line in the attachment shows the bottom bounds of the polygon collider used in the example videos.

    The concave corners frequently cause problems with the camera popping:



    I have turned on Damping which handles the popping beautifully, but this allows the camera to travel quite far outside the bounds depending on the target's speed:



    I would like to set up a system that has both a hard and soft boundary. The soft boundary would be where I want the camera to generally be and would have damping. The hard boundary would be a couple units out with no damping. However, Cinemachine won't allow for more than one Confiner on a camera.

    Another approach would be to have a parameter on the Confiner that clamps how far the camera can travel outside the bounds, not just dampened position by time.

    Any suggestions?
     

    Attached Files:

  2. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    It depends what kind of behaviour you expect, but you can try CmConfiner2D (not CmConfiner with 2D mode).


    We currently don't have an out-of-the-box solution for this unfortunately, but it is on our todo list.