picking problem

i have a problem with this code.when i pick an object with “Pick” tag it go through the other object. could you plz help me???

private var pickObj : Transform = null;
private var hit : RaycastHit;
private var dist : float;
private var newPos : Vector3;

function Update () {

    if (Input.GetMouseButton (0)) {

       var ray = Camera.main.ScreenPointToRay (Input.mousePosition);

       if (!pickObj) {

         if (Physics.Raycast(ray, hit) && hit.transform.tag == "Pick") {

          if (hit.rigidbody) hit.rigidbody.velocity = Vector3.zero;
          pickObj = hit.transform;
          dist = Vector3.Distance (pickObj.position, Camera.main.transform.position);

       else {
        newPos = ray.GetPoint(dist);

    else {
       pickObj = null;


Please add some more infos. which different objet ?

i want to pick up first person controler with mose as it floats in space.whit this code i cant pick up first person controller.i use a capsule whit rigidbody. but when i use this code for this capsule it go through other cube that i want to use.