Search Unity

[Cinemachine 2D Confiner] Confiner ignores PolygonCollider2D "Auto Tiling"

Discussion in 'Cinemachine' started by iodinex64, Jun 25, 2019.

  1. iodinex64

    iodinex64

    Joined:
    Mar 25, 2016
    Posts:
    7
    Hello,
    I am having a problem with using the PolygonCollider2D component as the Cinemachine2D camera confiner in Unity 2019.1.8f in my 2D project.

    When I set the PolygonCollider2D to "Auto Tiling" so that it will scale with the size of the tiled sprite it is a component of, assigning it as the confiner for a 2D cinemachine virtual camera ignores the "Auto Tiling" function and instead only recognizes the shape the collider would be if "Auto Tiling" were not checked.
    I am using Cinemachine version 2.3.4.

    Any help would be appreciated. Being able to set auto-tiling PolygonCollider2D's as cinemachine confiners would save me a lot of time and headache.

    I have attached two images; the auto-tiled collider when the object it's apart of is focused, and that same collider as it appears to the camera it is a confiner of.

    Thank you very much for your time.


    unityforumimage1.png unityforumimage2.png
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
  3. iodinex64

    iodinex64

    Joined:
    Mar 25, 2016
    Posts:
    7
    Hi Gregoryl,

    I'm not quite sure how this helps. I am not using tilemaps at all in my project. Instead I am using Unity's sprite 9-slicing functionality.
    All I am looking for is for Cinemachine to be aware I have "auto-tiling" selected on my collider so that it knows the collider should be the same size as the 9-sliced sprite.
    If there is a programmatic workaround for this, I am not sure how to go about it myself.

    Thank you for your time.
     
  4. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    436
    Hi,

    Using 2d colliders with auto-tiling and Cinemachine confiner won't work right now because the collider shape is generated while the confiner is retrieving the original collider shape.

    The only work around I can think of right now will be to manual edit your collider shape so that it matches the the area you want to confine to.

    We will look into how we can support this properly with Cinemachine.
     
  5. iodinex64

    iodinex64

    Joined:
    Mar 25, 2016
    Posts:
    7
    Thank you for your incredibly informative reply.
    I understand what I was attempting to do was something of an unusual and perhaps unoptimal case, but I couldn't understand why it wouldn't just work.
    Thank you for your time.