How to create a measurment tool in this way

Hi guys,
I am designing a tool to measure the distance between two points on a mesh.
However, now I am facing a technical issue.
I am trying to add a sphere on a given mesh. The movement of the sphere have to be only limited(constrained) on the surface of the given mesh. In other words, it is forever “on” the mesh, instead of moving to elsewhere.
How can I do this?

nice job
welldone

Thank you for your reply. I hope this is helpful to you.
I would appreciate if you can sponsor me by starring this project

哥们,看不懂这行东西

帮给Github项目点个星星支持一下 老铁666

牙医也学blender? :grimacing:

Thank you! It’ s a great solution and thanks for your contribution. :slightly_smiling_face:

学老铁,好好学习,好好学习