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