Snap system not working on rounded surfaces

Hello!

I’m having problems with my snapping script where it doesn’t work on rounded surfaces (smooth shaded) like with a ball or a cylinder. I know the cause but don’t know how to fix it.

The problems occurs because of the fact that smooth shaded surfaces have a computed normal and not “physical”. Due to this, it creates the same effect as if the cylinder/shape was made out of millions faces and because of the way the snapping works it leaves no space to move along the surface before changing the rotation offset applied to the position making it always stay at the same place and breaking the snapping code.

Would there be a way to fix this issue? Tough, I’m more interested in fixing another version of this code which is more efficient and will not have this issue. If you would want to see any of the two code please tell me.

Thanks !