Gesture Recognition, determining shapes

Hi guys,

So at the moment i’m creating a game in which the user draws runic symbols to cast spells (similar examples would be the magic in infinity edge or the gameplay mechanic of magic touch)

so at the moment i’m using a linerenderer to draw the user input. I’m storing the vector3 co-ordinates of the screen space in a list to record the user input. I was wondering what the most effective way to work out if the user has drawn a square / swirl / triangle is etc. Is it advisable to reduce the number of co-ordinates to a smaller number before trying to work this out and then calculating the number of angles within a certain range or… what would be the best way to do this?

sorry if this is a dumb question. just any pointers. In case you need to know i’m most comfortable writing in c#.

If you want to calculate the number of angles in a certain range for a user-drawn line, you might not want to count very small ones, as those were likely intended to be a straight line. You’ll have to experiment a bit on where you’ll draw the line between ‘angle’ and ‘not an angle’, and it won’t be foolproof.

What you will then probably want to do is store the angles you end up with in-order in an array or list (instead of the vertex positions - although you can start with those and work out where and what your angles are later), then compare with pre-stored lists of angles that define your shapes (with some margin for error). You may also want to check if the shape was closed, i.e. if your last vertex is close to your first.

I have no idea how you’d recognize a circle or any other shape with a curve in it though.
(I suppose you could try drawing some, see what kind of angles you get and see if you get a result that’s useable but I have some doubts on how well that would work).

Alternatively, you could look into some machine learning pattern recognition methods but…that might be a bit much. Maybe just stick to ‘edgy’ shapes.