I've had some working ghost objects for a while now, and recently I rotated one of them and noticed they started having an effect on objects outside of their bounds. It took me a while but I realized the Ghost shape was detecting collisions by AABB only. I did have the line:
Code:
PhysWorld->getDispatcher()->dispatchAllCollisionPairs(Ghost->getOverlappingPairCache(), PhysWorld->getDispatchInfo(), PhysWorld->getDispatcher());
...in my code initially, but it degraded performance and I tried commenting it out, and it still worked, so I left it commented out. I didn't really think at the time that Real shape collision results on a box without rotation looks almost identical to AABB collision results. ><
So I removed the comments for that line of code and tested it...with absolutely no change. I'm getting a large drop in performance for absolutely nothing. I snooped through the source code that was called, making one assumption, and one annoying conclusion.
On line 387 of btOverlappingPairCache.cpp it uses the provided callback to "processOverlap". On lines 236 and 238 of btCollisionDispatcher.cpp I see it is creating a btCollisionPairCallback to be used for the "processing". At lines 224 and 226 of btCollisionDispatcher.cpp, inside the "processOverlap" function it calls the dispatchers near callback and then is hardcoded to always return false. Which returns into this if statement:
Code:
if (callback->processOverlap(*pair))
{
removeOverlappingPair(pair->m_pProxy0,pair->m_pProxy1,dispatcher);
gOverlappingPairs--;
} else
{
i++;
}
This seems to make it difficult for a btPairCachingGhostObject to clean unwanted overlaps/collisions from itself. Which of course means it keeps all of it's old AABB collisions in it's overlapping cache.
Is there any way to get it to clean it's cache of collisions that are AABB only(and not the actual shape) that doesn't involve modifying bullet source code?