I’m currently working on a collision detection algorithm with a broad phase to detect possible collisions and a fine phase to do deterministic resolution of collisions. The broad phase is based on a hierarchical hash grid and is performing well.
The fine phase is based on a custom algorithm and is working with n-body collisions. In order to accurately resolve more than 2-body collisions, I will however need to somehow register all collisions and the corresponding elements in collision sets.
What would be the best way to save collisions in some way during the broad phase in order to iterate through the collisions sets in the fine phase? I was thinking along the lines of certain data structures, but I couldn’t come up with an ideal solution yet.
My current approach
After thinking about the problem a bit longer, I decided to try the following approach.
If a collision is now detected during the broad phase:
In the fine phase, I can now simply iterate over all collision sets in the collision list and do exact collision resolution.
The solution is rather fast, but I’m a bit worried about the memory foot print. I will have to do a couple of benchmarks to know more.