by measuring distance between sensor and object