Jittery Smoothed out camera because of low FPS

My Smoothed out camera is jittery and I realized this, because I testet some nwe generation for my game and funnily enough, because my optimization sucks, my fps have gone down to like 20-30, but there I noticed something: The camera is jittery the worse my FPS are. This is probably because I Update the Position in the Update function, but strangely enough using Fixed Update does not fix it. So I searched for methods to fix the Problem and found this post and tested every method in there, which changed nothing.
If you want to test the movement yourself, I got it from this video. I am somewhat of a perfectionist so this bothers me a lot and I need this fixxed or the game just looks bad.

The solution presented in the commentsection of the video does not work either btw.

The relevant code is here:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;


public class CameraMove : MonoBehaviour
{
    public Transform cameraTransform;

    public float zoomcount;
    public float movementTime;

    public Vector3 newPos;

    
    
    void Update()
    {
        HandleMovementInput();
        
    }

    void HandleMovementInput()
    {
       //newPos is just the newest calculated position when the camera moves
        transform.position = Vector3.Lerp(transform.position, newPos, Time.deltaTime * movementTime);

    }
    
}

If you’re tracking another object with the camera then you should use LateUpdate instead of Update.

You can also try disabling vsync so then Unity will render as many frames as possible.

And perhaps try Vector3.SmoothDamp instead of Vector3.Lerp. Although this obviously can’t help your frame rate but it may help to smooth the movement more. Also slowing down all movement in general can help to diminish the jittery movement that comes from having a low frame rate.

I am indeed not tracking another object and use the code one to one like the guy in the video. V-Sync would optimize the game, but it would not fix the problem for PCs that just run on 30 fps. I also already tried using Smoothdamp and it did not help sadly, but thanks for the effort.

I am also already thinking of removing the smooth camera alltogether in the worst case

Use Cinemachine instead? We don’t script, lerp, etc the camera directly anymore.

1 Like

Thank you!
Completely forgot about Cinemachine!