19-11-2021, 11:43 AM
(This post was last modified: 19-11-2021, 11:44 AM by josemendez.)
(19-11-2021, 11:29 AM)srid96 Wrote:Code:private void DeactivateTornParticles(int particleIndex)
{
for(int i = particleIndex; i < rope.elements.Count; i++)
{
rope.DeactivateParticle(i);
}
}
rope doing something weird, its like trying attach the cut portion, stretches long
You're mixing up particles and elements again: it does not make sense to iterate from particleIndex to the number of elements. There's a different number of elements than particles, and they're in different order. Element number 6 in the elements array might reference particles 24 and 65. You can't assume particle #6 is part of element #6.
Iterate trough elements past the (elm.particle2 == particleIndex) one, and for each element deactivate both particles. Then remove all those elements from the elements array.