We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I guess this might be sort of a math question, but hopefully some one knows how to solve this!
I'm using a ps3-controller and i want to translate the data i get from the analog sticks in to degree of arc (0° to 360° degrees). The data i am receiving now using the stick.getX() and stick.getY() command is this:
Stick resting: x 0.0 y 0.0
Stick pointing up: x 0.0, y 1.0
Stick pointing down: x 0.0, y -1.0
Stick pointing right: x 1.0, y 0.0
Stick pointing left: x -1.0, y -0.0
Stick pointing right and up: x 0.88..., y 0.88...
... and everything in between.
I would be really happy and thankful if someone could help me to translate this data in to numbers between 1 and 360. Ideally the different stick directions would result in this data:
Stick resting: 0
Stick pointing up: 360
Stick pointing down: 180
Stick pointing right: 90
Stick pointing left: 270
Stick pointing right and up: 45
Anyone got an idea?
All the best!