Distance between 2 objects (up to 75 cm), independent of angle
You could do this with ultrasound.  Use a transceiver on each end, send a ping on A.  On B, wait for ping and reply with a ping to A.  Calculate the round-trip delay when A receives the response ping.  Should drift slightly (and fairly predictably) with temperature and humidity but if your drift requirements are tight you can probably compensate.

You could also mount a camera above (or below if on glass) your objects and use OpenCV to find the objects and calculate the range.