Thanks, it seems to work perfectly if I run that, then step the simulation, then iterate over all pairs. But in that case, I can switch back to a regular object that just has no collision response, I think.
Well I think that you can use a ghost
object with no collision response + ghost
object manifold processing (in case of btPairCachingGhostObject), or a regular object with no collision response + global manifold processing.
(I'm not sure that the fact that an object has collision response or not is in some relations with the manifold creation and update...; for sure you can use it as a sensor.)
The line I posted should work for the latter case (i.e.: regular object + global manifold processing: ghost
objects might need a similiar one, but I'm not sure about it).
Anyway probably you can remove/readd the object to the world to be sure that the proxy get cleaned from pairs in both cases.
Thus I think the point is: why and when should I clean the proxy from pairs?
The answer to the first question depends on the application you're developing: do you get any improvement if you do it?
The second answer is relative to the frequecy of the call.
Every frame? Probably no, since in that case a plain aabb/contact pair query could be more efficient (not 100% sure about it).
Maybe just in critical situations that depend on the application (for example when you move the ghost
object to a very distant point or maybe when you spawn new objects inside it..., I don't know...).
In short: I don't know if this can be a solution to your application...