dynamic player object ignores collisions with moving static objects intermittently

I am making a sidescroller app where I have a player object walking on top of a static ground. Also, there is an area in the game where an object with static physics is rotating and being updated every frame. While the player is moving, the collisions work fine and as expected, however when the player stands still, (sometimes) the static objects pass right through the player. I researched this and thought it may have been a sleeping problem, but I prevented bodies from sleeping with physics.start(true) and the problem persisted. I then tried turning on physics outlines with physics.setDrawMode( “hybrid” ), and I saw that the player object was glowing orange while the player was moving, but when the sprite stood still, it dimmed grey. I have screenshots here:

highlighted physics outline(collisions working): http://prntscr.com/6yx3np

greyed out physics outline: http://prntscr.com/6yx46w

greyed out physics passing through object: http://prntscr.com/6yx2tm

When the sprite outline changes to the highlighted color, physics with moving static objects work, but when the outline is greyed after the player stops moving, the moving static objects can pass right through. I want the collisions to work all the time, how do I acheive this? Do I need to know when a collision is taking place and then pause the rotation incrementation so it does not interfere with the physics engine? The rotation is taking place every frame but not within any physics collision event.

The whole project is on github: https://github.com/jmb10101/stickman_sidescroller_app

I solved the problem. The physics body was sleeping after a short interval of inactivity. Even though the API said you could pass true in physics.start() and prevent all bodies from sleeping, that does not seem to work…Setting the isSleepingAllowed to false on the bodies does work.

I solved the problem. The physics body was sleeping after a short interval of inactivity. Even though the API said you could pass true in physics.start() and prevent all bodies from sleeping, that does not seem to work…Setting the isSleepingAllowed to false on the bodies does work.