Search Unity

Jitter camera movement after transition to Unity 2019

Discussion in 'Editor & General Support' started by TeaWithSalt, Jan 17, 2020.

  1. TeaWithSalt

    TeaWithSalt

    Joined:
    Jan 17, 2020
    Posts:
    4
    Hi there!

    After going to from Unity 2018.3.13f1 to Unity 2019.1.13f1 my camera becomes jitter when following the player. Before transition to new Unity everything was fine. It appears especially when fps is not stable.

    My player update position places in Update method. And only ruled by transform, no rigitbody applies.
    And camera position change is in LateUpdate.

    Camera code:

    Code (CSharp):
    1. private void LateUpdate()
    2. {
    3.       const int substeps = 10;
    4.       for (var i = 0; i < substeps; i++)
    5.       {
    6.             var t = (float)i / substeps;
    7.             var targetPos = Vector3.Lerp(_lastTargetPosition, TranslateTargetObject.position, t);
    8.             CameraTransform.position = Vector3.SmoothDamp(CameraTransform.position, targetPos, ref _camSpeed, (TranslateSmoothness * TranslateSmoothnessAdd) * 0.017f, Mathf.Infinity, Time.unscaledDeltaTime / substeps);
    9.         }
    10. }
    Code is a bit complex because I made more smooth movement with it. But even if I replace all camera movement with simple:
    Code (CSharp):
    1.  CameraTransform.position = Vector3.SmoothDamp(CameraTransform.position, TranslateTargetObject.position, ref _camSpeed, speedCoef, Mathf.Infinity, Time.deltaTime));
    Or Lerp instead of SmoothDamp. I get jitter.

    Does anyone know, what is the issue?
     
  2. TeaWithSalt

    TeaWithSalt

    Joined:
    Jan 17, 2020
    Posts:
    4
    I have found that deltaTime in Unity 2019 jumps from one value to another more than in previous versions. Maybe that is the case.
    Still waiting, maybe someone have faced with this problem.