Geometry. simple google search:
Quote: "
If you divide {x,y} by its length sqrt(x^2+y^2), then you have a
vector of unit length:
{x/sqrt(x^2+y^2),y/sqrt(x^2+y^2)}
There is a unique number t between 0 and 2pi (or between 0 and 360)
such that:
cos(t) = x/sqrt(x^2+y^2)
and
sin(t) = y/sqrt(x^2+y^2)
t is the angle you want.
- Doctor Jerry, The Math Forum
http://mathforum.org/dr.math/
"
Now, you just isolate t and you get
t = acos(x/sqrt(x^2+y^2))
t = asin(y/sqrt(x^2+y^2))
x and y are simply the x and y axis of the controller. so it generaly is a vector from 0,0 to x,y do a search on vectors and you might get your result
hi