For n points moving in 1 dimension.
Position and velocity are known for each point.
Each frame a basic integration is done for each point:
velocity += forces * timestep; forces = 0; position += velocity * timestep;
Each point (except for the first one) is attached to the point following it (e.g to its right) with a distance joint of the form
point2 - point1 < distance && point2 - point1 > 0
Which means that the points shouldn't be further appart than distance or closer than 0.
Energy should be conserved, i.e a point should be able to push/pull another.
I tried to solve every constraints with impulses, but it messes with velocities. (at least the way I did it..)
Searching around, I found a lot of resources but I'm unfortunately not able to understand all of it.
If anyone can give me a general idea / starting point ?