optomized collisions to exclude half of the tests
[physics.git] / src / collisionManager.cpp
index 9db130e..5d2dff0 100644 (file)
@@ -142,10 +142,10 @@ void updateEntities()
                      it2 != divisions[x][y].end();
                      it2++ )
                 {
-                    if( *it1 != *it2 )
-                    {
-                        applyCollision(*it1, *it2);
-                    }
+                    if( *it1 == *it2 )
+                        break;
+
+                    applyCollision(*it1, *it2);
                 }
             }
         }