How can I get the collision direction of a hit?

Are you sweeping? How’s the wall collision? 2d is not my field so bear that in mind as I might be missing something crucial here.