Search Unity

Issue with transitioning two cameras opposite each other

Discussion in 'Cinemachine' started by Aaron-Meyers, Jan 16, 2019.

  1. Aaron-Meyers

    Aaron-Meyers

    Joined:
    Dec 8, 2009
    Posts:
    305
    I have a scene where two cameras in a room are facing directly opposite each other and at certain moments, they transition to and from each other. What I was looking for was a 180 degree sweeping turn from one camera view to another, but the results were really bad... a weird delay followed by an almost instantaneous flip.

    Initially, the views were exactly 180 degrees apart, so I figured that perhaps this was some kind of gimbal lock sort of issue and how would Cinemachine even know which direction to sweep the camera?

    So I cheated each camera's target transforms a little bit in the direction I wanted the camera to turn so that maybe it was now more like a 178 or 179 degree difference. When the transition occurred, it was still extremely wonky... a one second transition where only a frame or two showed the sweep!

    At some point I realized that these cameras had the same priority level, but it didn't seem like it should matter because the camera I wanted to transition to was still taking precedence when I wanted it to. So I tried giving it a higher priority and it seemed to mostly fix my issue! Problem solved... right?

    However, I came back to the scene with nothing else changed and its back to its old ways.

    I've created a very simple test project that reproduces this issue. Ideally, I'd like my cameras to be as close to 180 degrees apart as possible, but I can living with it being a little bit off, but at the moment, the camera transition is completely unusable.

    The cameras are largely static in the scene so even though they are currently using a Composer component for their aim, they could probably use anything else that would help with this scenario.

    -A
     

    Attached Files:

  2. Aaron-Meyers

    Aaron-Meyers

    Joined:
    Dec 8, 2009
    Posts:
    305
    By the way this is Unity 2018.3.0f2 using the latest Cinemachine from the package manager.
     
  3. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Last edited: Jan 17, 2019
    Aaron-Meyers likes this.
  4. Aaron-Meyers

    Aaron-Meyers

    Joined:
    Dec 8, 2009
    Posts:
    305
    @Gregoryl to the rescue again!!

    Thanks... that did the trick. Can you explain a bit more about what that Blend Hint thing is all about and what the other options are useful for? If I was taking a multiple choice quiz, I probably would have guessed one of the others...
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    The other blend hint options control the path the camera takes when blending between cameras looking at the same thing. Say you put a bunch of cameras around an object and switch between them. In that case you probably want the cameras to take an orbiting path when they blend, not a straight line which is the default.

    The Screen Space Aim when Targets Differ is a little subtle. It influences how the camera rotates to frame a new LookAt target. Without the hint, the camera will look at a point that lerps from one target position (in world space) to the next. With the hint, the camera rotation is slerped instead.