private int AddParticleAt(int index) { // Copy data from the particle where we will insert new particles, to the particles we will insert: int targetIndex = rope.activeParticleCount; rope.CopyParticle(rope.solver.particleToActor[m_SourceIndex].indexInActor, targetIndex); // Move the new particle to the one at the place where we will insert it: rope.TeleportParticle(targetIndex, rope.solver.positions[rope.solverIndices[index]]); // Activate the particle: rope.ActivateParticle(targetIndex); return(rope.solverIndices[targetIndex]); }