Contact listener not being called

Hello, and thanks in advance for your help.

I'm having a small issue with the ContactListener. I use the postSolve method to set which faces of the body are in touch (all my bodies are rectangles xD), and every gameLoop I reset those touching values to zero. So, for instance, if a bodyA is above bodyB, bodyA is touching down and bodyB is touching up.

The thing is that after a couple of steps with one body above the other, the contact events stop being fired and I can't update this touching direction variable. Funny thing is that if I move horizontally the postSolve method is called and the update is done.

What I would like to know is whether, for some kind of optimization, contact events stop being fired after some steps.
Perhaps the bodies are sleeping? You could SetSleepingAllowed(false) if that is the problem.
Thanks for answering so quickly =)

So if sleeping is allowed, collision events stop being solved? Would it impact too much on performance if I did SetSleepingAllowed(false)?

I am at work right now, I will try it later at home and post my results.

Thanks!
Right. Each group of connected bodies or 'island' can sleep when nothing is happening to it. It will awake when some external change occurs like a collision from outside or you applying impulses or something.

Unless you have a very large scene with a lot of bodies usually sleeping I don't think you'll see much change. If it's a problem, you could probably do something clever like storing the last result you got in PostSolve and returning that if the body is asleep.
Thanks, this really helped me. I used your suggestion to save the state when the body is asleep.

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