Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Confiner 3D Screen edges - does not work

Discussion in 'Cinemachine' started by Captain_Flaush, Jul 26, 2019.

  1. Captain_Flaush

    Captain_Flaush

    Joined:
    Apr 20, 2017
    Posts:
    65
    Hello,

    I need to use the 3D confiner with screen edges on my scene.
    - All cameras are ortographic (the game is isometric)
    - Bounding box is bigger than camera at any point

    However it does not work. Screen shot attached.

    The 3D confining code for screen edges seems broken... or I don't get the math behind it.

    Do I have any other alternative to keep the camera in some boundaries?

    I use a group framing transponser and need it to stay in some bounds.

    Please advise
     

    Attached Files:

  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    Confine Screen Edges only works with 2D confiner.
     
  3. Captain_Flaush

    Captain_Flaush

    Joined:
    Apr 20, 2017
    Posts:
    65
    Can I use a 2D confiner in my situation? Can I rotate a 2D Polygon Collider?
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    I don't think so... but not 100% sure.
    Can your 3D camera be placed obliquely (with arbitrary rotation) inside your 3D confiner?
     
  5. Captain_Flaush

    Captain_Flaush

    Joined:
    Apr 20, 2017
    Posts:
    65
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    oh, I wasn't suggesting a solution... I was inquiring about your scene. I'm trying to understand whether you expect the camera to take on any angle inside your bounding box, or whether you're restricting it to be axis-aligned.

    You could certainly write a custom confiner to suit your needs. Copy the existing one, rename it, and make any mods you want. Thanks to its inheritance, it will show up in the vcam's Extensions dropdown.
     
  7. Captain_Flaush

    Captain_Flaush

    Joined:
    Apr 20, 2017
    Posts:
    65
    If anyone is interested, I solved the problem by confining the center of the camera and modifying the boundaries of the confiner.
    Also making sure that this works on different screen resolutions as I am on mobile.