Spring Force
Opened this issue · 0 comments
nshelton commented
https://github.com/mxsage/growth/blob/master/src/simulation.cpp#L390
hey, I'm working on a compute shader version of this. I noticed that this is a little different from the spring force described in the lomas paper, which would be more like
{
glm::vec3 target;
for (auto l : p.links)
{
glm::vec3 d = p.position - cells[l].position;
d = glm::normalize(d);
target += cells[l].position + parameters.springLength * d;
}
target /= p.links.size();
target -= p.position;
p.delta += target * parameters.springFactor;
}
target doesn't subtract p.position at the end, so it shouldn't be used as a delta. Also the sum equation is a little different, yours may be equivalent, not sure. But the delta thing is definitely a problem