Snap one 3D object to another mesh

Hello guys,

do yo have any ideas, how to snap one object to another. For instace, one box (with drag behaviors) should be aligned to another “static” mesh, and movable in x, y, and z direction. Should i use dragPlaneNormal?
I tried some logic from other playgrounds, but i failed with implementation.

Thank you very much !

I think you should setup a PG with everything working except the snapping, it will be easier for people to help you (your PG is only showing two static cubes).

Here is an example I code some weeks ago with dragging a mesh and snapping to an other one if the distance is near enough:


I updated it, thank you.

Looks amazing. I need something similar, but snap to outside of mesh, not inside. Just over surface from another mesh. Thank you!