How attach one sphere to another sphere on draging of sphere

hai friends.

Here i have so many spheres in bottom of screen, and i am trying to take them into middle of screen one by one. When i am dragging one sphere nearer to another sphere, this sphere should stick to that sphere automatically.

How to write script alt textplease help me. I am totally confused.

You will need a Mouse grab (google it), if distance between those two objects is less than something, create a spring (or other) joint on the go, that part will connect to other.