//delete the current net from the environment public void removeNet() { foreach (RigidBody rb in curentNet.netEdges) { dynamicPhysicsObjects.Remove(rb); } foreach (SpringJoint sj in curentNet.netRopes) { springs.Remove(sj); } curentNet = null; }
//delete the previous Net and add the new one public void addNet(DynamicNet newNet) { if (curentNet != null) { removeNet(); } foreach (RigidBody rb in newNet.netEdges) { dynamicPhysicsObjects.Add(rb); } foreach (SpringJoint sj in newNet.netRopes) { springs.Add(sj); } curentNet = newNet; }