P#50864 2018-03-26 17:07 ( Edited 2018-03-27 20:53)
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
One optimization path for a very large number of things colliding between each other is to "bucket" actors.
That is, for each update, for each actor:
- get list of buckets the actor is in
- unregister actor from buckets
- update actor position
- register actor into in new buckets
Collision between 2 actors might exist only if the bucket count is > 1.
Getting the list of possible colliders is done by iterating over the content of each bucket the actor touches:
Some reference material:
https://conkerjo.wordpress.com/2009/06/13/spatial-hashing-implementation-for-fast-2d-collisions/
"Gif" example:
![](https://www.lexaloffle.com/bbs/files/25532/nuke_cmap.gif)
P#50902 2018-03-27 16:53 ( Edited 2018-03-27 20:53)
[Please log in to post a comment]