Priximity swiches detect metal at a distance of a few millimeters. Ultra sonics doesnt't work through glass.