Lerp has some bumping effect

Hello,

I took this script from the unify wiki, that it is supposed to smooth the movement of the camera. I wanted to follow a race car, but when he car moves, the camera is a bit bumpy.
How can I fix that?

var target : Transform;
var distance = 3.0;
var height = 3.0;
var damping = 5.0;
var smoothRotation = true;
var rotationDamping = 10.0;

function Update () {
	var wantedPosition = target.TransformPoint(0, height, -distance);
	transform.position = Vector3.Lerp (transform.position, wantedPosition, Time.deltaTime * damping);

	if (smoothRotation)
	{
		var wantedRotation = Quaternion.LookRotation(target.position - transform.position, target.up);
		transform.rotation = Quaternion.Slerp (transform.rotation, wantedRotation, Time.deltaTime * rotationDamping);
	}

	else transform.LookAt (target, target.up);
}

Vector3.Lerp and Quaternion.Slerp interpolate between two values based on the value being the last parameter. Setting that value to 1 will be the same as not using Lerp/Slerp at all. If the camera is “bumpy” in your case, the issue might be the value set is too close to 1, which makes the camera get to target position/rotation too fast. Try reducing the damping and rotationDamping based on “bumpiness” in position/rotation of the camera.

Also, what might be the issue. The car is probably moved by a code in another script which is also executed in Update or FixedUpdate function. Positioning the camera should be done AFTER all the car positioning has been done, so you should change the Update to LateUpdate in this script. That will make sure the camera is trying to chase the new, correct, position of the car, rather than chase the old/current/new position, based on the execution order of the scripts.