Search Unity

Cinemachine blend question

Discussion in 'Cinemachine' started by Ksanone, Dec 23, 2020.

  1. Ksanone

    Ksanone

    Joined:
    Feb 7, 2015
    Posts:
    41
    Hi, thank you for making Cinemachine. I have a question about how to change camera movement during a blend.
    - during a freelook cam to a virtual cam that has "lock on" behaviour.
    - using priority change to trigger the blend.

    Any info would be appreciated.

    During blend from freelook to lock on, the camera blends by moving smoothly backwards in a straight line/path. During lock on to freelook the camera rotates down midway ie like a curve. I would like the camera to follow a straight line during the transition so there is no dip.

    I hope the following images help to explain.
     

    Attached Files:

  2. Ksanone

    Ksanone

    Joined:
    Feb 7, 2015
    Posts:
    41
    more info
     

    Attached Files:

  3. Ksanone

    Ksanone

    Joined:
    Feb 7, 2015
    Posts:
    41
    more info

    thanks for any advice
     

    Attached Files:

  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    The blend will by default lerp from the outgoing vcam's LookAt target position to the incoming vcam's LookAt target position, and look at that lerped point during the blend. I'm not sure where your LookAt targets are.

    Have you tried setting this blend hint? That will do a screen-space lerp instead of a worldspace lerp.

    upload_2020-12-28_10-16-34.png
     
  5. Ksanone

    Ksanone

    Joined:
    Feb 7, 2015
    Posts:
    41
    Thanks for the help.

    The freelook cam LookAt target is a Gameobject parented to the main player Gameobject. It sits just in front of the player's mesh at head height.

    The virtual camera (LockOn style) LookAt target is a CinemachineTargetGroup that is filled as follows
    - position 0 - player - assigned in editor
    - position 1 - lock on target added and removed through script

    both have weight 1, radius 0 - changing the values doesn't fix the issue.

    Both have Blend Hint as advised above, and for good measure all the other combinations possible don't change the issue.

    The LockOn cam during transition to FreeLook still dips to aim at about player waist height before angling up to look at the head height object.
     
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    One more thing you can try: make the FreeLook's LookAt and Follow targets be the same point. If your current Follow target is at the player's feet, then it would mean moving it up to the chest area (and adjusting the orbit heights accordingly). Sometimes the "inherit position" logic in the FreeLook can get confused when the target heights are different.
     
    Last edited: Dec 30, 2020
  7. Ksanone

    Ksanone

    Joined:
    Feb 7, 2015
    Posts:
    41
    Still the same rotation down during transition from LockOn to Freelook. Could I share the project file with you? I feel like its a very obvious thing but I am just missing it.
     
  8. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    Sure, you can send me the project. Please make sure to give clear repro instructions.
     
  9. Ksanone

    Ksanone

    Joined:
    Feb 7, 2015
    Posts:
    41
    So whilst trimming the project to send I accidentally cleared the CinemachineTargetGroup which had the player in the first slot, assigned from inspector. I did that after following an old thread on these forums about making a LockOn Camera.

    Without the player in the CinemachineTargetGroup the issue is solved. The transition to LockOn to FreeLook is smooth. I think the CinemachineTargetGroup was just doing its job by assigning a LookAt position between the player and target and so how this messed with the transition.

    I guess that's what happens when you blindly follow something.

    Thanks for your help (and sorry for wasting your time).
     
    Gregoryl likes this.