Quantcast
Channel: Answers by "kburkhart84"
Viewing all articles
Browse latest Browse all 33

Answer by kburkhart84

$
0
0
The easiest way is to create a vector2d from the 0,0 to the mouse position. Figure out the angle it is pointing at using the angle function of the vector2 class. Then you have to make a decision. Which angles are which directions. Say from 22 degrees to 78 degrees is upper right, 78 to 112 degrees is "right", and so on. This basically works by grabbing the angle as it is raw data. Then figuring out if it is closer to 0, 45, 90, etc... and choosing that direction, all via the if statements.

Viewing all articles
Browse latest Browse all 33

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>