"Draw" object by mouse while play (simple shape recognition)

I want to add the ability to draw objects with the mouse (like a magician in Trine). The question actually is, how to determine the figures drawn with the mouse, and compare them with the necessary objects ( there are few objects)?

Thanks for help!

This is a complex topic. I suggest you investigate terms like “gesture recognition”. The easiest approach will involve recording the mouse position over time, and comparing the resultant collection of points against “paths” you, the designer, create.

In Trine, IIRC, there were only boxes and planks. That should be very straightforward. IIRC, the size of boxes and orientation of planks also mattered. This can also be accomplished during your gesture recognition loop.

Keep high-poly square and line segment shapes, perhaps as mesh objects. When the drawing action ends, compare the resulting mouse path against the vertex data of the sample objects. Luckily, for a few simple, distinct shapes you can allow for a wide margin of error, thus reducing your stress as the programmer.