Trying to find how the 'y' position of a Raycast with ScreenPointToRay is set

Hello, I have a 2d game that is laying down in the x & z. You click and drag a game object across the screen. This work, the only problem I have is, when I get the 'hit.point' the 'y' that gets returns is extremely 'high'. I try and set it manually after but it glitches and jumps back and forth from the 'y' in the hit.point to the 'y' that i set manually. Any help at all would be greatly appreciated. Thanks Fabrizio

function Update ()
{
    if (Input.GetButton("Fire1"))
    {
        var ray: Ray = mCamera.ScreenPointToRay(Input.mousePosition);
        var hit: RaycastHit;

        if (Physics.Raycast(ray, hit))
        {
            if(!rockCreated)
            {
                var rock: GameObject;
                var newPosition = Vector3(hit.point.x, hit.point.y, hit.point.z);
                rock = Instantiate(rockPrefab, newPosition, City.transform.rotation);
                Physics.IgnoreCollision(rock.collider, City.collider);
                currRock = rock;
            }
        }

        if(rockCreated)
        {
            Debug.Log("Y position of Hit" + hit.point.y);

            currRock.transform.position.x = hit.point.x;
            currRock.transform.position.z = hit.point.z;
            //currRock.transform.position.y = hit.point.y;
        }
    }
}

The if(rockCreated) bit should really be inside the if for the raycast, otherwise you're checking against junk or null values, and setting the x/z every frame the mouse is down

If you do want to set the x/z every frame the mouse is down, regardless of hitting something, then store a vector3 when you hit, and set them using that vector instead - i'd skip using the hit variable for anything outside of the raycast check