Programming collision detection is surprisingly easy just use a ray at each side to which you then add @bump and so on...