Chain on path - I finally solved it!

You know the problem of having a chain of “train cars” following a path, while both ends of the cars need to stay on the track, and the cars can’t change in length? Regular follow path procedures don’t work, as they usually only calculate the distance along the path, which falls apart as soon as there are tighter curves in the path.

I’ve been trying to get this solved for years now, and finally I got the idea that made it possible. It uses the geometry proximity node in a repeat zone to isolate points on a (highly resampled) curve. It starts at the first point in the curve, samples a point at distance X (in case of multiple points it takes the one with the lowest index - thus picking the one next in line on the curve), and sets that point as the next one to sample from. Each time a point is sampled, it gets a boolean flag set to add it to a “selection”. The repeat zone iterations act as the number of links you want in your chain, the proximity distance reflects the length of the links. Once the selection is complete, only these points are kept, effectively creating a curve with segments of equal length. Trimming the initial curve moves the chain along the path, allowing for proper “train” animation.

You can then link any geometry you want to these segments.

9 Likes

Two years old, but still not in master? At least mine works right now in 4.3 :wink: