Convert game stick inputs to d-pad inputs
A game stick, or a joy stick, is one type of game controller that looks like this:
__
( )
||
||
___|""|__.._
/____________\
\____________/~~~
I built a demo page to show how to map the inputs from the stick to up, down, left , right signals.
It refreshed my memory on vector math a little bit, which was fun.
Basically, a cross product can be utilized to determine which side one vector lies with respect to another vector.
References:
I pretty much learned how to draw a page like this from watching following Youtube channels.
Highly recommand:
Poth on Programming
Web dev simplified