Cast To without overlap

Thank you very much! Tell me please, is there an elegant way for the character to move on the surface of the object and not fall off it?