Let’s say you have a line with multiple points. The starting point is fixed and the last point follows mouse position. That way all the other points are fixed too. Length between the points is automatically calculated. The red line is the direction vector between start point and end point, the black line is the current line drawn. How do I make the middle points move to their new positions on the direction vector (a.k.a the new line)?

I made it work. Used these lines of code:

```
float posAlongDir_y = (float)i * mousePos.y / (float)(segments - 1);
float posAlongDir_x = (float)i * mousePos.x / (float)(segments - 1);
```

Basically get the index of current point (for loop), multiply it by current mouse position and divide it by the number of points.