# Follow objects as if there was a magnetic field using animation Nodes

Using animation nodes how can I make an object keep following and other object with some delay, a behavior very similar to the one you can see in most paint tools for stabilizing strokes, here is an example: https://www.youtube.com/watch?v=ah13EISw7nc

The only difference is that at the end of the transform both objects should have same location.

EDIT

here a perfect example of what I'm trying to reproduce, but without "actions" enter link description here

• Isn't that, that it is necessary to hold shift, while drawing, to have this "magnetic effect"? Dec 12, 2020 at 11:32
• For the example provided could be, but I am not trying to reproduce de stabilizer function, I shared the link in order to show how objects should behave. The idea is to move an object and this other object should follow the first one with a delay. Dec 12, 2020 at 11:42

Method 1 (Recommended)

You can evaluate Fcurves to get trailing or attractive effect. You need a source object with location keyframes. Then follow node tree given below.

Method 2

We can also do this without keyframed source object by storing positions of object. For storing object transformation as Matrixlist:

setattr(AN, "store", Matrix4x4List()) if frame == 1 else AN.store.append(x)

Get stored Matrixlist:

AN.store[-amount:]