Chain simulation

I need to simulate a working roller chain. The chain is over 500 links long and it needs to run in real time. I’m using Blender for modelling and animation. I have the same question up in AnswerHub.

Here’s what I have now. Looks ok but links overlap a bit. There’s just too many links on the system so the performance hit is too huge. I need to calculate the player distance from the instance index location and decide if it needs to be updated. I just can’t figure out how I can start and stop the animation based on the player location.

Or does someone have a better solution for this?

This should help the distance thing, as for improving the performance, I’m no help on that sorry

I tried to do it like this because I need to measure the player distance from the current instance location but it doesn’t seem to work. It still updates all the instances all the time.
1b3b8639d0a33c3974f1df44503c716c82418f3f.jpeg

Try this, I think it should fix the distance problem
In place of Get Path Length, put a v-v and a vector length node