The modulation of the deflection of a 2D guided optical beam in a planar waveguide is analyzed for sensing applications. The deflection is caused by a gradual change in the depth of the planar waveguide transversal to the direction of propagation. The beam deflection angle could be used for sensing the refractive index of the external medium among other variables. We present numerical results to evaluate the possibility of developing a glass-integrated structure for refractive index sensing.