Hello!
In the past I did this before 5.2 a different way – without using the UI. I’d like to only use the UI for these things now.
I have the virtual “Joystick” below. The large circle is a button, and the small is the “stick” that I’d like to follow the players finger around.
I figure I can do a “Pointer Down” and “Pointer Up” event on the button to start and stop the joystick following, but I’m unsure of a few things:
1) What’s the best method of knowing which finger is down? Again, in the past, I’d do this differently, via code, and I’d use the touch code I had been using before. Is there a new method of knowing the finger number or what not? I figured this one out. Just calling the phase began on the touches gets the info, like before. Works well it looks like
2) What’s the best method of getting the finger position? I’ll need to know the position in screen space, and convert that to the position that the UI element needs to be at, correct? Well, damn. Looks like transform.position works for UI elements. Who knew. In screen space. So all this time I was looking for something complicated, when transform.position = Input.mousePosition etc would work. Crazy world.
3) What may be a good method of keeping the joystick from going beyond the boundaries of the larger circle?
Thanks!!!
