How do i implement 8 direction swipe function

238604-vectorcompass.jpg

hey guys,
I am trying to implement swipe functions into my game, so essentially determining whether the person swipes N, NE, E, SE, S, SW, W, NW and then outputting into a function based on the direction they swipe.

I have figured out how to do N, E, S, W (up, down, left, right)
however, I am stuck on the diagonal functions. (NE,SE,SW,NW)

Hope that makes sense, Thanks guys

ok so i tried the acos approach and it didnt seem to be working out so i done some research and tried the atan2 function instead with the broken up X & Y values and now works perfectly. thank you so much for your help :slight_smile: