Zzzzrrr wrote:
Erin Catto wrote:
I'm working on implementing a broad-phase on top of the dynamic tree.
So does this mean you're keeping Sort & Sweep (aka Sweep & Prune), but applying it on top of a dynamic tree? Can you explain the theory or provide a reference for learning purposes?
Also, have you considered Christer Ericson's Hierarchical Grid (Hgrid)? He seems to think it's one of the better broadphase methods available, and I'm inclined to believe it would be great for particle collisions. But alas, there is no perfect broadhphase; it really depends upon the application.
How about providing a library of pluggable broadphase methods optimized for different scenarios: S&W, QuadTree, Hgrid....?
Sweep and Prune will be gone and hopefully not missed.
In Christer's book, I recommend reading the section on incrementally built bounding volume trees. I don't think the dynamic tree will be great for particles. For that I would use a uniform grid (assuming all the particles are the same size). For rigid body simulation, we cannot assume objects are similar in size. Otherwise I would use some sort of grid.
The idea for using a dynamic tree for a broad-phase was developed by Nathanael Presson for the Bullet physics library.
My intention with Box2D is to make a full featured, robust, and efficient rigid body simulator. I know that people would like to have particle and fluid support, but this is outside the scope of my work right now. I don't think this is precluded, but it will require community development.
I'd rather not support multiple algorithms for different components of the engine. Instead, I'd like to pick the best possible algorithm and have it supported as well as possible (avoiding virtual function calls as well). However, I do try to limit dependencies between components, so it should be possible for the community to provide alternate implementations.