Likely the player's bounding box is getting stuck in jagged terrain. You should set the bounding box a little higher than the player itself so that it isn't dragging on the floor. You will also have to adjust your code so that the gravity does not always force the character's bounding box to the floor.