/* * Sum forces applied to this object */ public void SumForces() { for (int i = 0; i < 3; i++) { particle_states[i + 3] = 0; } // Sum forces for (int index = 0; index < forces.Count; index++) { // Check if force is zero Force force = (Force)forces[index]; if (force.CheckState()) { // remove zero force forces.RemoveAt(index); Destroy(force); } else { // Update state velocity with the sum of all forces for (int i = 0; i < 3; i++) { particle_states[i + 3] += force.Values[i]; } } } }