Skip to main content
added 103 characters in body
Source Link
JPtheK9
  • 2k
  • 2
  • 15
  • 34

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?

My project has upwards of 3000 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?

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?

edited title
Link
JPtheK9
  • 2k
  • 2
  • 15
  • 34

Efficient Collision PairCollisions Iteration?

Source Link
JPtheK9
  • 2k
  • 2
  • 15
  • 34

Efficient Collision Pair Iteration?

My project has upwards of 3000 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?