- Home /
Drawing a Circle/Square/Triangle etc via Unity for Ipad
Okay, I've seen an article for doing the above but so far haven't seen anyone actually posting the code for doing this.
What me and my co-programmer is trying to do is make a mechanic where you draw a shape of some sort and then have it activate an ability. I have seen the posted links to create this script however I'm looking for something that I can program in C#, has anyone else tried this before and has a coding starting point?
I've dug out the GetTouch script in a previous article and am trying to use it to draw points on the Ipad/Android to register the shapes. Any help is appreciated, thanks in advance
Answer by Macdude2 · May 17, 2011 at 04:48 AM
So like the lego harry potter for iphone spells? All I can think of is creating button like areas on the screen around the perimeter of the shape. Then when the finger is run along these buttons, the script detects if the finger has touched all of them. And if it has, then then a function is activated. However, having a lot of shapes that could be drawn at any point would get complicated because then you would not only be detecting if the finger hit them all, but then in what order. It would also be hard if the player did not have a guide to where he should draw his finger. If he drew it too small or too large, it might not register, this could frustrate him or the programmers.
Answer by DaveA · May 17, 2011 at 06:34 AM
What you're talking about it 'gesture recognition' and you can google for that, there are many articles (though I don't know if any are for Unity per se). You can use the Line Renderer, Trail Renderer, or Vectrosity to draw lines to follow your fingers.
Your answer
![](https://koobas.hobune.stream/wayback/20220613134541im_/https://answers.unity.com/themes/thub/images/avi.jpg)