When I move the object next to another object with the mouse, I want them to come side by side without any space between them, like a magnet?

I think I understood, you want the two boxes to stick their edges together ?
I won’t know how to do that to help you.

Maybe someone else will have an idea.

this is exactly what i want

Two objects attract each other from all directions, but I want them to stop as soon as they touch each other. The objects overlap each other, how can I solve this problem?

You need to detect when objects overlap and stop the attraction. See: Mesh Intersections | Babylon.js Documentation (babylonjs.com)

I solved the problem, but I want to use any model instead of the sphere object, but it does not have the features of sphere. How can I solve this problem? It is necessary to have any model instead of sphere