0

I am trying, given the position along the $X$ and $Y$ axes from a controller, where the positions range from $-1$ to $1$ ($1$ being up on the Y and right on the X) to convert this to the direction of travel in degrees on a compass.

e.g.
X=1 and Y=-1 = 315 degrees
X=-1 and Y=0 = 180 degrees
X=0 and Y=1 = 90 degrees

Could someone help with the math please?

Milo Brandt
  • 60,888

1 Answers1

0

I'm assuming this is programming related, in which case the atan2(y,x) function is designed exactly for this (though it probably outputs in radians, so you'd have to multiply by $\frac{180}{\pi}$ to get degrees)

Milo Brandt
  • 60,888