Using the touch event’s coordinates, I am trying to calculate the angle in which the joystick is moved towards.
My code below is producing the wrong results:
local adj = event.x - event.xStart;
local opp = event.y - event.yStart;
local angle = math.deg( math.atan(opp/adj) );
Intended output:
360
|
|
|
180-------------0
|
|
|
90
[import]uid: 75783 topic_id: 13023 reply_id: 313023[/import]