Camera Shaking At High Speed

Hello,

Im in the middle of making a space sim, But i seem to be having problems with the camera, It follows the ship and pulls away from the ship as the ship gets faster, But when the ship is at max speed the samera seems to shake, At first i thought it might be the ship controller script causing the ship to shake but i guess not, Can someone have a look at this code and see if theres anything wrong? Thanks.

var target : Transform;

var distanceToFollow : float = 5.0;

var height : float = 1.0;

var moveSpeed : float = 1.0;

var rotationSpeed : float = 1.0;

 

private var targetRay : Ray;

 

 

function Update () {

 

    //move the camera into position behind the target

    targetRay = new Ray(target.position,-target.forward);

    point = targetRay.GetPoint(distanceToFollow);

    point = Vector3.Slerp(transform.position, point, Time.deltaTime * moveSpeed);

    transform.position = point;

    

    //rotate the camera to match the rotation of the target 

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

This is probably because first, your camera object adjusts its rotation to look at the object, then your object moves a tiny bit in its update step, next the scene is rendered, now the camera will not look exactly at the object since it moved a bit.
To solve this, put the camera updating code in LateUpdate instead of Update.