Converting xbox controller sticks to theta

Hi, The xbox controller has 2 analog sticks. They output values of x and y (rectangular). I want to convert these values to theta. How can I do this?

Math.atan2 ( y, x ) returns the angle theta .

beware of the order of the parameters, Y first, then X .

Thank you. I feel like the y axis is inverted. When I move the stick up it paints my arrow down.

maybe because the screen Y axis grows in the oposite direction of a normal cartesian Y axis . (i.e. moving up in your screen means decreasing Y, while in a cartesian plan it means increasing , and that is probably how the controller returns the values. )

How could this be fixed?

hum … inverting your Y on calling Math.atan2 ?

Or flipping your transform… whichever makes more sense in your game.

Like this? Math.atan2(1/y, x)

You are flipping the Y axis, so:
Math.atan2(-y, x);

Sorry my mistake. I originally did that but it didn’t work. I realized it was an error in my code.