// array containing the active humans. public final Array<Human> activeHumans = new Array<Human>(); // object pool. public final Pool<Human> humanPool = new Pool<Human>() { @Override protected Human newObject() { return new Human(100, 500); } }; @Override public void update(float dt) { checkCollisions(); } public void checkCollisions() { // human-human collision for (Human h1 : activeHumans) for (Human h2 : activeHumans) if (h1.getRectangle().overlaps(h2.getRectangle())) { h1.setX(h1.getX() + 2); h2.setX(h2.getX() - 2); } } Here he throws me out with Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: #iterator() cannot be used nested. . If you make human-otherObject or even
for (Human h1 : activeHumans) for (Human h2 : activeHumansOther) , then everything works, but, of course, not with those that I want (only human - humanOther , and I need human - human ). How to make it so that the first option works - when the humanes collided, they diverged in different directions?