Hello, in general there is such a thing, it was necessary for the game to create something like https://www.assetstore.unity3d.com/#/content/1100 just such a thing, but I have no idea how to do this, someone can understand and can tell tutorials or any features to do this. I'm not exactly right, but at least if I drew a circle, it showed me that it was a circle, and if I drew a square, it showed me that it was a square. Can someone suggest?

    1 answer 1

    Here is a flash drive that does exactly what you want. You can decompile it and try to figure out how it works. In short, the principle is: there is a database with signs. Signs are stored as a set of coordinates of the points of the sign in the order in which they appear in the sign. All coordinates are normalized (i.e. lie in the range from 0 to 1). When the player clamps the mouse and starts moving it, the recording of the mouse coordinates into the array begins. When the user releases the mouse, the coordinates are normalized, and the alternate comparison with the coordinates of each character begins. In this flash drive, all the coordinates of the mark drawn by the player are compared with all the coordinates of the mark from the database, for each point entered by the player, the nearest point from the base is searched. The average distance to the nearest points is remembered for each character from the base. After checking all the characters from the base, the one for which the average distance is the smallest is searched. This sign is considered to be matched. If all the average distances are greater than a certain threshold, it is considered that not a single sign has approached. The variant is bad because its complexity is O (N M K), where N is the number of characters in the database (for more accurate recognition, you need several samples of each character), M is the number of points in the character entered by the player, K is the average number of points in signs from the base.

    There is one more option, less resource-intensive, but more difficult to implement. Read about neural networks, they are often used for pattern recognition. But you have to train it for a long time, and somehow decide the question of how to present the input data (for the neural network has a fixed number of inputs, and the number of points in a figure drawn by the user can vary greatly).

    • Something seems to me in the example that I cited there are no such complex functions, but thanks for the advice. - dajver