Dotted line on curve?
Make a curve, attach empties as hooks to each end of the curve, parent then those hooks/empties to the objects.
That way when the objects move apart the curve will follow and grow.



For the curve to have some thickness, make it 3d and add some bevel.



CYCLES rendering 

To create the dotted lines for the curve, use a checker texture to control the transparency on a material .