How to initiate "snapping" of an object to another with the presence of another object? I'm relatively new to Blender 3D so I'm not acutely aware of any limitations that may persist.

I was wondering how one could initiate snapping of objects together with the presence of another object. So for example, another object A comes along and picks up multiple object B and creates a organised chain of object B.

Thanks for your time!

Edit:

I'm hoping to create a simulation. Long story short, I'm creating a genetic algorithm integrated into blender, but that information for this question is irrelevant. In terms of what objects they are, a rigid body object A picking up another rigid body object B, like a magnet. Object A then collects more rigid object B and snaps them together in a chain, with the objects adjacently organized.

Here is a quick sketch of what I mean:
I would suggest working backwards with a bunch of offset copy location constraints. This will be a manual process for the most part (unless you want to script the major repetitive tasks) because it is not something that can be done easily and automatically with one of Blender's simulations.

If this is what you are going for, see the blend that I uploaded (of course the starting positions of the balls could be changed to whatever really easily to make them appear to be picked up instead of emitted.





To achieve what I did in the blend:


Animate "object A"
Add a copy location constraint to an "object B" that tracks to "object A"
Animate the "influence" of the cp loc constraint on "object B" for when you want it to "attach"
You can use the offset on the copy location constraint and simple location animations to achieve what I got in the demo