Search Unity

Bug Camera lerps into place at the beginning of a scene

Discussion in 'Open Projects' started by vjs22334, Feb 5, 2021.

  1. vjs22334

    vjs22334

    Joined:
    Oct 11, 2018
    Posts:
    11
    Regarding This Issue: https://github.com/UnityTechnologies/open-project-1/issues/340

    I think I have a fix. warping the vcam to the player after setting the target seems to work.

    Code (CSharp):
    1. public void SetupProtagonistVirtualCamera(Transform target)
    2. {
    3.   freeLookVCam.Follow = target;
    4.   freeLookVCam.LookAt = target;
    5.   freeLookVCam.OnTargetObjectWarped(target,target.position-freeLookVCam.transform.position);
    6. }
    you can see the behaviour in the video in this comment: https://github.com/UnityTechnologies/open-project-1/issues/340#issuecomment-773475400


    I guess the distance can be adjusted a bit to warp the camera to a set distance away from the player. But based on my testing warping the camera directly into the player's position is the most consistent in tems of camera movement

    is this behaviour ok? can anyone think of any potential problems?
     
    Last edited: Feb 5, 2021
  2. cirocontinisio

    cirocontinisio

    Joined:
    Jun 20, 2016
    Posts:
    884
    No, I think it's a great fix and, to be honest, I didn't know of the existence of that function! I guess the Cinemachine developers foresaw this potential use case.

    We can then tweak the position later on, but for now, this is a great and probably unharmful fix to the issue.
    Yes, if you could make a PR it would be great! Thanks!