Search Unity

Cinemachine change camera position based on player's position

Discussion in 'Cinemachine' started by hushuyan002682, Jan 12, 2019.

  1. hushuyan002682

    hushuyan002682

    Joined:
    Jan 12, 2019
    Posts:
    2
    Hi there, I have a question about using cinemachine blend. For example:
    upload_2019-1-12_12-3-19.png
    I had two cinemachine cameras: CM1 and CM2. If I had a player moving from position A to position B, cinemachine camera can switch CM1 to CM2 smoothly by using blend. What if the player moved to position C and stopped, it that possible for camera moving to somewhere between CM1 and CM2, like position P, and stopped as well?
    * Further question, if the player from A to C then stopped and started move backed to A. Is there any way to move the camera from CM1 to P then move back to CM1? (I explain my question in another way: can cinemachine camera changing position according to player's position when switching camera?)

    Any suggestion will be greatly appreciated. Thanks in advance.
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    2,501
    It's not possible to interrupt Cinemachine when it's blending due to a camera activation, unless you set the game's timescale to 0.

    However, you might be able to get what you're looking for with the CinemachineMixingCamera. This is a manager camera that delivers a continuous blend of its vcam children, according to the weights that you control. If you map the weights to player position, then you will get what you want. Have a look at the BlendListCamera sample scene in CinemachineExamples.