Camera Rotation "Jitterness" (.LookAt)

Hello UnityAnswers, I have something to ask you.

In this script that I’m making, it works well, however there is a slight jitter to it.
Take a look for yourself.

So how can I get rid of this jitter? I have used Quaternion and it hasn’t worked. Please help.

 Script
/*Explanation
This JavaScript will control camera movements, rotation, and any effects included.

The camera rotates around the character, with a point on the outer casing of this "sphere"
rotational pattern.
*/
//
//Public Variables
public var cameraMaxDistance : float;
public var cameraMinDistance : float;
public var cameraRotationSpeed : float;
public var cameraMaxHeight :  float;
public var cameraMinHeight : float;
public var cameraTarget : Transform;
public var cameraMain : Transform;
//Private Variables


function Update ()
{
	var xon = Input.GetAxis("Mouse X");
	cameraMain.LookAt(cameraTarget)
	if(Input.GetButton("Fire1"))
	{
	cameraMain.transform.Translate(xon * cameraRotationSpeed * Time.deltaTime, 0, 0);
	}
}

Your Jitter occurs because you first rotate to look at the object, then you move the object. So in the next frame LookAt snaps the angle again. One fix is to move the cameraMain.LookAt() below the if-block. That way any camera movement happens before you rotate the camera to look at the object (and both happen in the same frame).

Try moving the code to LateUpdate instead of Update, since the camera’s transform is reliant on things that move during update.