Late joiner!
I would recommend capacitance, assuming (1) there is an opportunity to calibrate and (2) the environment is fairly free of non-repeatable (i.e., cannot be captured during calibration) outside influences. Block A has active electronics on it. Block B has a metal (foil works) plate on the side facing Block A. Block A includes one plate of a capacitor, a driven shield for that plate, and a ground "plate" (consisting of a ring of foil around the perimeter of the side facing Block B).
The field from the driven center plate to the grounded perimeter is forced to extend fairly far out into space. The disturbance by the foil on Block B alters the capacitance between the center plate and ground. Measure the capacitance (there are various ways) vs. distance to establish a calibration curve and you are done. This is fairly immune to temperature, very susceptible to dielectric constant change of the intervening material, and very cheap to build (under $30 in electronics - voice of experience!). One part in 400 is not too difficult to do with a 2nd order curve fit (8-bit microcontroller is sufficient, but a math library helps!), but accuracy also depends on movement being restricted to X direction.
Late joiner!
I would recommend capacitance, assuming (1) there is an opportunity to calibrate and (2) the environment is fairly free of non-repeatable (i.e., cannot be captured during calibration) outside influences. Block A has active electronics on it. Block B has a metal (foil works) plate on the side facing Block A. Block A includes one plate of a capacitor, a driven shield for that plate, and a ground "plate" (consisting of a ring of foil around the perimeter of the side facing Block B).
The field from the driven center plate to the grounded perimeter is forced to extend fairly far out into space. The disturbance by the foil on Block B alters the capacitance between the center plate and ground. Measure the capacitance (there are various ways) vs. distance to establish a calibration curve and you are done. This is fairly immune to temperature, very susceptible to dielectric constant change of the intervening material, and very cheap to build (under $30 in electronics - voice of experience!). One part in 400 is not too difficult to do with a 2nd order curve fit (8-bit microcontroller is sufficient, but a math library helps!), but accuracy also depends on movement being restricted to X direction.