Check to see if a player draws the right shape
Basically I wanted to add a function to look at a shape the player will draw with whatever means of input they are using and check it for accuracy with pre-defined shapes. I'm sure you've seen games like this. Stuff like Okami, or Magic Touch on droid.
Without giving too much away, cause I'm not asking for code, I'm just asking how does this get done. If this was asked before, please be patient with me, I didn't see any question like that when I posted. :)
Thanks for reading.
I went back and thought more about my question and thought I should add this: Let's assume the drawing function will look for the player to draw within a rect or specific area by drawing a sprite where the player touches/moves mouse, or moves an indicator or some kind. How do I check for accuracy of predefined shapes in that area?
Wow 3 days an no answer? I must have picked one of those questions lol
This kind of "image recognition" problems can be pretty difficult.
$$anonymous$$y first instinct would be to triangulate and make a polygon out of the drawn shapes, overlay them and subtract the area of one from the other. The size of the "difference area" would be at least some kind of an indicator of similar shapes. Google for example "delunay triangulation" to get started on triangulation.
You'd have to "normalize" the position (crop the shapes before comparing ) of both shapes too so that drawing the exact right shape in the wrong position wouldn't result in a bad score.
Awesome. Thanks for the response. I was out of town so I couldn't respond. I will take a long look at this to see if I can cobble something together. I knew this wouldn't be an easy subject, but I think it would be awesome if this functionality is coded properly.
Answer by NicoFad · Apr 28, 2017 at 02:26 PM
https://www.reddit.com/r/Unity3D/comments/3rkr4s/trying_to_recognize_drawn_shapes/
This link might help you. In the comments there is a scientific paper someone'd suggested but failed o implement it, however, it is very interesting. Otherwise if you want an out-of-the-box solution I highly suggest checking out the market place and the keywords "Glyph Recognition" https://www.assetstore.unity3d.com/en/#!/content/48975 I am just about to buy this one because I am very lazy, might try implementing it myself though.
Answer by syouleaf · Sep 04, 2021 at 06:20 AM
MiVRy - 3D Gesture Recognition https://assetstore.unity.com/packages/templates/systems/mivry-3d-gesture-recognition-143176 This might be helpful!