Visualization of the input

So to recognize a gesture you firstly have to draw a patern. To do so i followed two tutorials that i found on the youtube.  Special thanks to youtuber Holistic3d.
Single stroke video 
Multi stroke video
I enchanced the code with some flag values and a coroutine. In my project I want to be able to draw multiple lines but not at the same time. The coroutine is there to make the pattern fade out of the screen (even though the fading out isnt implemented). This can be changed with multiple ways. One of the alternatives that I have in mind is to let the player draw multiple lines simultaneously. I might change this in the future.

After following the Holistic3d tutorials that I mentioned before you have a working prototype to draw lines on your screen either this is on your PC or in your phone. Adding the corutine that essentially deletes the pattern from your screen after a certain amount of time will give you unlimitted amount of space to draw new patterns.

I decided to extend this two ways of drawing on your screen with one more. I wanted to use the accelerometer on the phones to replace the touch drawing. The implementation was really easy but the results that I saw wasnt tottaly correct or at least they weren’t as i would expect them. The gravitational pull of the earth gives an acceleration to the phone and this messes up with the results that are being drawn in the screen. I found two ways of solving this problem. The first one is to use the phones gyroscope to get the accual gravitational pull on all the three axis each frame and substract it from the accelerometers mesurments. Unfortunatelly my Huaweii P9 lite does have a gyroscope. The second sulution that I found on the Internet is to create a low pass filter for the accelerometers input. I might try it out in the future. But as i was thinking of it I want to exclude the gravitational acceleration to visualize the pattern on the phone’s screen. Thus i am able to recognize the pattern that a player does using his cellphone as a magic wand as far as he holds the cellphone with similar orientation every time he casts a spell.

Leave a Comment