@isaac-ng said in ToF for scanning doesnt work as desired: vl6180x I've not used this particular sensor, but judging from the datasheet it uses IR led illumination and has a 42 degree field-of-view (http://www.st.com/content/ccc/resource/technical/document/datasheet/c4/11/28/86/e6/26/44/b3/DM00112632.pdf/files/DM00112632.pdf/jcr:content/translations/en.DM00112632.pdf, chapter 2.10.1). It probably 'averages' the distances measured withing its field-of-view, causing a gradual transition from distance 1 to distance 2. If you really need a step response in the measured distance you'd likely need a sensor with a very small field-of-view, e.g. a laser bundle. On the other hand, the point with the maximum slope in the transition from 1 to 2 will probably be very close to the actual step in your shape.