Just in case it's applicable, according to the Biki and the OFPEC comref, distance measures above ground level and only map distances, not vector distance. So, if the projectile is not traveling parallel to the ground, distance will return an inacurrate result I think.