Closed soylomass closed 6 years ago
world.broadphase.aabbQuery is what you need. Check this issue https://github.com/schteppe/p2.js/issues/288
I believe the question has been answered so I’ll close the issue. I just wanted to add that aabbQuery is definitely not O(N^2)... even if you implemented it naively it would still be linear complexity. The SAPBroadphase should be linear - it sorts the bodies using insertion sort (should be linear) and then builds and returns the result (also linear).
I want to find all the bodies overlapping a certain area. And as all the bodies of my world are of similar sizes, I think a quadtree would be the best way, as aabbQuery does a N^2 query. Can I do this with p2?