I can move it instantly so far, and I also need to maintain level height (y=40)
if (Input.GetMouseButtonDown(0))
{
Plane plane = new Plane(Vector3.up, new Vector3(0, 40, 0));
Ray ray =
Camera.main.ScreenPointToRay(Input.mousePosition);
if (plane.Raycast(ray, out float distance))
{
transform.position = ray.GetPoint(distance);
}
}