Problems with creating soft body in processing

I am having trouble forming a soft body where each side is a spring. When they are created, they do not merge into one object, but create as many springs as there are vertices in the figure. This code is responsible for the formation of the body:

 SoftBody(ArrayList<PVector> verticies, float mass_)
  {

    for (int i = 0; i < verticies.size() - 1; i++)
    {
      sidesAndDiagonals.add(new Spring(new Circum(verticies.get(i).x, verticies.get(i).y, verticiesRadius, mass_/verticies.size()), new Circum(verticies.get(i + 1).x, verticies.get(i + 1).y, verticiesRadius, mass_/verticies.size()), springRestLenght));
    }

    sidesAndDiagonals.add(new Spring(new Circum(verticies.get(verticies.size() - 1).x, verticies.get(verticies.size() - 1).y, verticiesRadius, mass_/verticies.size()), 
      new Circum(verticies.get(0).x, verticies.get(0).y, verticiesRadius, mass_/verticies.size()), springRestLenght));

    mass = mass_;
  }

This is my entire code: https://pastebin.com/1XJrWCne

Hi! It’s nicely divided into classes while I cannot spot the issue at a glance. One potential problem is that you are updating and drawing at the same time. This can lead to a problem because the bodies and springs interact with each other, so usually it’s better to split the update and draw functions, and once all the bodies are updated, do another iteration to draw.

You could add debug draw mode to show the vectors of force, for example. This may help spot the problem quickly instead of examining the code line by line.