Follow mouse cursor (with Y = 0)?

How can I use the ScreenPointToRay to get my GameObject to be aligned to the floor (using only x and z)? Instead of using a distance variable to do this:

		ray = Camera.main.ScreenPointToRay(Input.mousePosition);
		mousePos = ray.origin + (ray.direction * markerDistance);
		playerTarget.transform.position = mousePos;

How can I have it instead of spinning around in a “spherical” pattern, how can I get the y axis to always be 0, but the object will still be in the correct location?

Put a Plane (maybe without a mesh renderer) for the floor, and set its layer to “floor”.
Then use this code:

    ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    Physics.Raycast(ray.origin, ray.direction,
        80, 1 << 10 /*change 10 with the number of the floor layer*/);