object follow mouse position in 3d world.

here code that i using

var s : Transform;
function Update () 
{
        var ray = Camera.main.ScreenPointToRay (Input.mousePosition); 
        var hit : RaycastHit;

                 if (Physics.Raycast (ray, hit))
         {
            //Debug.Log(hit.point);
            var a = hit.point;
            s.position = a;
        } 
}

it not working. something like object go to camera position. how to fix it?

if you want your world to look 3D, you should be using a perspective camera. in that case, you will want to use Camera.ScreenToWorldPoint(), which takes view space coordinates. do this for both zNear and zFar because the x/y values of each point will almost always be different in perspective view. ray.origin is the transformed zNear point, and ray.direction is the normalized delta between then zFar and zNear point.