Hi,
If it's just a straight line, then that's ok-ish.
Unfortunatly, the forum search is down, so I can't link to posts on that topic, but basically, that would be the following:
you use 3dplanedrag custom action to define your mouse point on a specific plane, and then express that point in your path transform. then you kill the x and y values, you are left with z with is the distance from the start.
going this way will give you a linear constraint for positioning as well as a sense of distance from the start.
To detect that an object reaches the end of the line, use a collider.
NOW, another solution is to use physics joints. If you use physics 2d, you can even use the sliding joint and you are good to go! I would experiment with this first actually. 3d physics have configurable joints and they can do sliding constraints too.
bye,
Jean