My project has upwards of 3000 2D objects but not all of them collide with each other. Between each object that can collide, a CollisionPair is created and stored inside a flattened array.
Currently, a MaxObjects is defined for accessing the flattened array. Unfortunately, when iterating over this array for collision checks, I get a lot of overhead from the for loop and null checks.
Is there a more efficient way, both in memory and performance, to store and access CollisionPairs?
Note: Many of these objects are axis-aligned boxes - how does Minecraft handle these collisions?