The best distance depends on the pressure setting. With lower pressure you should be closer. However, a rough, spattered finish is USUALLY from too great a distance! Or, maybe too high a pressure or insufficient thinning ratio. The normal problem with being too close is too rapid a buildup and runs. Finding the proper distance is a practice issue.
Practice on scrap styrene (or, if primed, any scrap hard surface). Find the appropriate distance for each pressure setting and thinning ratio. Personally I run my Badger 200 at 15 psi for gloss finish, 20 for flats. I thin new paints 1:1, increasing the thinner for older bottles of paint where some solvent has gone away.