Camera/mouse movement issues "almost but no dice"

I am having some issues with this code. It works fine if the mouse cursor is on the bottom half of the screen but as soon as its moved to the top have it goes wherever it wants.

Thanks for the help.

var lookTarget : Vector3; var turnSpeed = 20.0;

function Update() {

var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hit : RaycastHit;
if (Physics.Raycast (ray, hit)) 
{
    lookTarget = hit.point;
}

// rotate towards target
var lookDelta = (hit.point-transform.position);
var targetRot = Quaternion.LookRotation(lookDelta);
var rotSpeed = turnSpeed * Time.deltaTime;
transform.rotation = Quaternion.RotateTowards( transform.rotation, targetRot, rotSpeed );

}

Set tag of your terrain to "Terrain"

var lookTarget : Vector3; var turnSpeed = 20.0;

function Update() {

var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hit : RaycastHit;
if (Physics.Raycast (ray, hit)) 
{
    if(hit.collider.tag=="Terrain")
    lookTarget = hit.point;
}

// rotate towards target
var lookDelta = (hit.point-transform.position);
var targetRot = Quaternion.LookRotation(lookDelta);
var rotSpeed = turnSpeed * Time.deltaTime;
transform.rotation = Quaternion.RotateTowards( transform.rotation, targetRot, rotSpeed );

}