How can I set a following camera which doesn't rotate with the object

The script of Object:

var smooth:int; // Determines how quickly object moves towards position
private var targetPosition:Vector3;
var speed = 60;

function Update () {

    if(Input.GetKeyDown(KeyCode.Mouse0)) {
            var playerPlane = new Plane(Vector3.up, transform.position);
            var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
            var hitdist = 0.0;

            if (playerPlane.Raycast (ray, hitdist)) {

                    var targetPoint = ray.GetPoint(hitdist);
                    targetPosition = ray.GetPoint(hitdist);
                    var targetRotation = Quaternion.LookRotation(targetPoint - transform.position);
                    transform.rotation = targetRotation;

    var dir:Vector3 = targetPosition - transform.position;
    var dist:float = dir.magnitude;
    var move:float = speed * Time.deltaTime;

    if(dist > move){
            transform.position += dir.normalized * move;

    else {
            transform.position = targetPosition;

    transform.position += (targetPosition - transform.position).normalized * speed * Time.deltaTime;


The Camera


I want to set the camera so it follows the object, but doesn’t rotate when it does.
Currently every time I click The camera rotates with the object making the sence
of location lost.

I think you could put a RigidBody or something in the camera and freeze the rotation on all axis.