Search Unity

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:
    27
    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:
    2,725
    Confine Screen Edges only works with 2D confiner.
     
  3. Captain_Flaush

    Captain_Flaush

    Joined:
    Apr 20, 2017
    Posts:
    27
    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:
    2,725
    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:
    27
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    2,725
    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:
    27
    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.