This might help you. https://gamedev.stackexchange.com/questions/168600/player-gets-stuck-on-edges-be...