# Have particles with different speed travel the same distance

My goal is to create a particle system with particles travelling at random speeds, but all dying after having travelled the same distance. Too bad for me, particle life seems to be dependent on time only. This makes the faster particles race past their goal, while others don’t make it.
I had hoped to, but did not find an easy way to explain the concept of ‘path’ to a particle system. True: you can influence speed over lifetime to create something which looks like a path, but since I want randomise speeds, while all particles share the same lifetime, they won’t move in the same pattern.

A solution which I am considering is that, if I really want particles moving at different speeds to travel the same path and distance, I need to adjust particle lifetime, per particle, after birth, based on speed and desired distance.

`lifetime = desiredDistance/currentRandomSpeed`

However, with varying speeds over lifetime, the calculation would not be so simple, and instead require me to calculate the primitive of the curve representing speed over lifetime. It’s getting unmanageable pretty quick.
Also the code would ideally be informed at every particle birth, but as I’m new to Unity’s particles, I have yet to find a way to get notified of such an event. Ugly workaround: check at time intervals.

So the short question is: has anyone found a solution which allows particle life to be determined by distance travelled or its position on a path (spline)?

Similar (unsolved?) issue: Set Particle lifetime by distance, not time? - Questions & Answers - Unity Discussions

If the really important thing is to have the particles “die” at the same point in space, you could use OnParticleCollision (Unity - Scripting API: MonoBehaviour.OnParticleCollision(GameObject)).

It may be a touch heavy for mobile devices (depending on the number of particles, of course), but it should greatly help with making sure they all expire at the same point.

That way, you can get away with simply setting a random speed per particle, and watching them go.