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.

https://playground.babylonjs.com/#6XIT28#734

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).

I updated it, thank you.

https://playground.babylonjs.com/#6XIT28#737

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