Hi all, I am new to java and libgdx and maths come to think of it! I am trying to make an on-screen joystick for the android side of life. So far I have drawn a filled circle and another smaller filled circle at the same centre coordinates. I have the thumb circle moving around in regards to mouse and touch, with ‘touchDragged’ and resetting the thumb to centre with ‘touchUp’.
At this point I am stuck! I can use .dst to find the distance between the centre points(vector2) and the thumb circle(vector2) and I can find the angle 0 - 360 from the x line. But how can I set the bounds and no the x and y coords so you can’t move the thumb circle outside the bounds of the larger background circle.
I think the solution involves soh cah toa but my limited math skills are letting me down. Can anyone point me in the right direction please I have been trawling the internet with limited success.
Many thanx in advance
Darren