Search Unity

POV and Blend problems

Discussion in 'Cinemachine' started by pcg, Jan 17, 2019.

  1. pcg

    pcg

    Joined:
    Nov 7, 2010
    Posts:
    292
    I have two virtual cameras that have an aim set so they can track an object vertically but not horizontally so I set the aim to be of type POV with a horizontal range of zero.
    However when I blend from one to another there is rotation on the horizontal axis. Can I stop this?

    Here's what I have...
    I have a number of rooms in a dungeon which have north south east west door ways.
    Each room has a virtual camera with the following settings.
    Body set to transposer with a 0,-40,-20 follow position.
    Aim set to POV with a limit on the vertical of 70 to 80 and a horizontal range of 0 to 0, which stops the aim following horizontally.
    I have a confiner which allows the camera to move up vertically only within a small range.
    Moving from east to west vcams which are on different z positions causes a horizontal rotation which I dont want.
     
  2. pcg

    pcg

    Joined:
    Nov 7, 2010
    Posts:
    292
    I'm currently sifting through the Cinemachine code to see if I can but someone may know the answer already...
    Can I override the rotation calculated by the blend with an Extension ?
     
  3. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    The extensions won't directly affect the result of a blend, only the inputs to the blend, so that wouln't be a great approach.

    Unfortunately we don't have an Aim confiner out of the box, but you could make one using the Extension API. However, you could still get rotations as the result of a blend.

    One thing I would try: make an Aim Confiner to restrict the rotations of the individual vcams, and then use this blend hint on the vcams: ScreenSpaceAimWhenTargetsDiffer. I assume that when transitioning horizontally betweenn vcams A and B, they have different LookAt targets. Is that the case?
     
  4. pcg

    pcg

    Joined:
    Nov 7, 2010
    Posts:
    292
    @Gregoryl thanks for pointers.

    Yes I've tried having different look at targets which are on the same x location as the respective virtual cameras.
    I had it set to ScreenSpaceAimWhenTargetsDiffer and encountered the problem. When I set to none the problem went away for a horizontal vcam transition but a vertical can transition produces an odd spin part way through the blend. I'll look into it some more and see if I can find a solution.

    FYI I'm currently restricting the aim via the POV horizontal aim range.
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    One other thing you could try: whenever the brain sets the camera's transform it issues a CameraUpdated event. You could hook into that and clamp the camera's rotation there.
     
    pcg likes this.
  6. pcg

    pcg

    Joined:
    Nov 7, 2010
    Posts:
    292
    Thanks, thats got it.