Search Unity

Granular control of blending? Holding a camera blend between two points?

Discussion in 'Cinemachine' started by LittleCatman, Feb 2, 2019.

  1. LittleCatman

    LittleCatman

    Joined:
    Nov 8, 2016
    Posts:
    6
    Is it possible to control a camera's progress/position between a blend, and hold it somewhere between the two using Cinemachine?

    For example, the player has their own virtualcamera following them (A). An important item in the scene has a stationary virtualcamera focused on it (B). While the player is more than 10m away from the item, the camera is focused on the player and fully blended to (A). When the player is less than 1m away from the item, the camera is focused on the item, and fully blended into (B). If the player stops 5m away, the camera would be blended halfway between (A) and (B) and held there, blending towards (B) as the player gets closer, and blending back towards (A) as the player gains distance from the item.
     
  2. Onat-H

    Onat-H

    Joined:
    Mar 11, 2015
    Posts:
    195
    Oh, I would love to have that too!
     
  3. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    Take a look at the CinemachineMixingCamera. It allows you to do a continuous blend of multiple vcams, controlling the weights in any way you like, for example as a function of target distance to some object.

    Set up the first child as vcamA, and dynamically set up the second child as vcamB.
    You'll need a separate script to control the weights, just attach it to the vcam.
     
  4. LittleCatman

    LittleCatman

    Joined:
    Nov 8, 2016
    Posts:
    6
    Thanks Gregoryl, having a look at CinemachineMixingCamera, it looks like this is exactly what I need. Appreciate your quick reply, and all your hard work!
     
    Gregoryl likes this.
  5. Onat-H

    Onat-H

    Joined:
    Mar 11, 2015
    Posts:
    195
    Thank you!