Crash on collision filtering : PX_ASSERT(fp.type != FilterPair::INVALID);

Hello, I have a crash with physX with my collision filtering system.

Basically, I need to delay dynamic/kinematic collision for a few frame to give a chances to our own triggering system to react to the collision (and eventually swith the body to dynamic) before physX compute the reaction between the bodies.

The way I handle this is as follow:

  • disabling the collision in the pairFound(...) callback while recording the pairID in an array of _disabledPairs
  • moving the pairID from the _disabledPairs array into a _collidedPairs array when onContact(...) is called
  • after one update of my own engine, moving all pairs from the _collidedPairs array into a _pairsToEnable array
  • enabling every pairs in the _pairsToEnable array when the statusChange(...) callback is called
  • If the pair is lost during the process, the pair id is deleted from the arrays (_disabledPairs, _collidedPairs, _pairsToEnable) in the pairLost(...) callback, so a lost pair can't be enabled

This basically works quite good, but from times to times, I have a crash after enabling back a pair. The crash occurs in the void Sc::NPhaseCore::fireCustomFilteringCallbacks() method. The exact line of the assert is: PX_ASSERT(fp.type != FilterPair::INVALID);

But I can’t find out what exactly is wrong with my code…

  • My first guess was that the pair I was enabling was a wrong pairId, but I double checked this part, so except if physX 'forgot' to report a pair as lost, everything seems correct.
  • I also double checked that my collision filter system would not tag a pair as PxPairFlag::eSOLVE_CONTACT when it should not (kinematic-kinematic collision...), and I have no more warning from physX about wrong pair flags.
  • I tried to understand why the fp.type of the pair could be left to FilterPair::INVALID, but I did not really managed to understand this part. I found out the part of the code where the fp.type is filled out, but it seems many pair are left with the FilterPair::INVALID flag without it being a problem, and I don't see why it becomes a problem in my case, nor how I can check this before enabling back a pair...

Did anyone already got this error ?
Does anyone known what to look at to try to solve it ?

So nobody ever had this crash ?

I still get this error from time to time, and still don’t really know what’s going on.

Last clue I have is: is there a chance that a collision pair ID changes when the kinematic mode is set or removed ?