Choppy Camera Follow

Hi, I’m using a custom sidescroller script and am getting extremely choppy camera movement. I know many people have had this issue, and I’ve been trying all kinds of suggestions with no luck. My script:

void Start () 
	{
		origDist = distance;
	}

	void Update () 
	{
		if (target)
		{
			if (Input.GetKey(KeyCode.LeftControl))
				distance = origDist * 5;
			else
				distance = origDist;

			Vector3 targetPos = target.position + Vector3.up * extraHeight;
			targetPos.z = -distance;
			transform.position -= (transform.position - targetPos) * 0.25f;
			
		}
	}

I’ve tried FixedUpdate and LateUpdate as well. How can I get this script to smoothly follow a normal character controller? Thanks!

Whenever you’re doing any changes to positions inside Update, multiply by Time.deltaTime as that will make it time-dependent instead of frame-dependent.

 transform.position -= (transform.position - targetPos) * 0.25f * Time.deltaTime;

I know you’ve mentioned that you’ve tried the script in FixedUpdate, but give it a try…