The code was always using the deformed positions from the active object rather than from the object currently being processed.
The code was always using the deformed positions from the active object rather than from the object currently being processed.