20-10-2020, 12:24 PM
(This post was last modified: 20-10-2020, 12:36 PM by josemendez.)
Code:
for (int i = 0; i < rope.elements.Count && i < data.particles.Count; i++) {
solver.positions[rope.elements[i].particle1] = data.particles[i];
solver.invMasses[rope.elements[i].particle1] = data.invMasses[i];
}
This code doesn't make much sense. There's always more particles than there are elements in a rope (at least one more), so if you stop iterating when you hit the amount of elements, you're missing particles.
No need to use elements for this at all, as you don't care about the order in which data is stored. Simply iterate over all particles in the rope instead, I believe this will fix your issue . Let me know if you need further help!