Draw a circle on touchscreen

Hey everyone,

I once played this nice little game on a smartphone. The player had to draw a circle with his finger on the touchscreen. The circle was drawn visible on the screen and then the player was given feedback on how accurate the circle was.

So I would like to know how to best approach something like that.

Getting Input from the finger and drawing a symbole

Checking the accuracy of the drawing and giving feedback.

I’m not looking directly for code (but always welcome;) but rather a pointer in the right direction.

Thank you.

I start tackling that problem by taking vector points every so often from when the touch starts to when the touch ends. You could use Camera.ScreenPointToRay and LineRenderer. Those can give you a connect the dots effect (with or without dots). When the touch ends you can auto complete by accessing the first vector point.

If you want to fill in the circle perhaps you can generate a mesh/2D shape, but I have little experience in that.

To check accuracy, get the center of the drawn circle. Take the radius using each vector point. The closer to average radius each one is means the more perfect the circle is.

I’m sure there is an advanced formula that takes each point and the preceding point and figures out where the next one should be based on the difference between them and the diameter of the circle and something else, but that may be overkill.