HI, folks! Ive got problem with distance measurement between two screen positions (Vector2) - joysticks boundary is rectangle like, but it should be like cycle (i thought using distance variable as radius and it would provide cycle like boundary).
PS. this script is based on Penelope tutorial Joystick script
Thanks in advance!
asked Jul 04 '11 at 08:08 PM
Ah, given you're picture the problem is clearer - your gui boundary is smaller than you're moveDistance. You need to clip an area inside the rectangle - so the guiboundary needs to be at least moveDistance on its shortest side. Bunny83's answer is the way to code it, once you've checked that the touch is inside the rectangle (otherwise it will move the joystick for a touch anywhere, presumably not what you want).
answered Jul 05 '11 at 05:34 AM