Allowing Body to Pass Through Other Body After Contact Estab

I'm trying to make it so that if the player or enemy is sitting on a platform and they want to drop down through it they can. I extended my own ContactFilter class so if you are holding down while contact with the platform is first made the player goes right through it but how would can I remove, in a sense, the contact with the platform that has already been established, allowing the player to pass through it?

Right now the relevant part of my ContactFilter looks like this

Code:
if (body1 is Character && body2.name == "Floor") {
   if (body1.isMovingUp() || body1.isHoldingDown()) {
      return false;
   }
}
else if (body2 is Character && body1.name == "Floor") {
   if (body2.isMovingUp() || body2.isHoldingDown()) {
      return false;
   }
}


Again, this works if contact with the platform is first being established but not if the player is already on it and then the user decides they want to drop down. Any ideas?
I think what you are looking for is the ContactListener. One of the functions that you have to implement is "PreSolve" (when you create your own ContactListener). From their comments:

"This is called (PreSolve) after a contact is updated. This allows you to inspect a contact before it goes to the solver. If you are careful, you can modify the contact manifold (e.g. disable contact). "

I personally have not used this, but it seems to be what you need.

Another way you could accomplish this is the one you are doing now, the problem is that the ContactFilter only seems to be called to add the Contact to the list, or to make sure the Contact should remain on the list.

If you are willing to check out the box2d code, look at b2ContactManager, method AddPair. This is called when 2 fixtures begin colliding for the first time, and the first time the ContactFilter gets called (line 84ish). The second time the ContactFilter is called is in the Collide method (line 232 to 254...ish). It indicates if the contact is flagged for filtering, then call the ContactFilter again, but at the end of the if statement, it removes the flag. I did not dive deeper into the code to see how to set that flag, but if you do figure out a way, the second you want the player/enemy to no longer collide with the platform/ground, you tell it to do contact filtering again, and use what you have.

I hope this helps.
Yes, PreSovle is the way to go. Take a look at the 'one sided platform' example in the testbed, it uses a slightly different method for determining when the contact should be disabled (this is all very well if all your platforms are flat - you'll have to come up with something more clevererer to handle other surface orientations.)
Code:
      if ( position.y < m_top + m_radius - 3.0f * b2_linearSlop )
      {
         contact->SetEnabled(false);
      }
To allow the player to drop through you just need to also disable the contact when the down key is pressed, or whatever the control to drop through the platform is. You might also need to SetAwake(true) for the player body in case it has gone to sleep.

Original thread: https://box2d.org/forum/viewtopic.php?t=7626