Print a Ball & Socket joint as one piece

I tried something similar with a hinge but without success. The play between the parts was something like 0.2mm. Resin between the two parts was cured. Changing the gap to 0.5mm made it successful.