Measuring "Press" Movement


#1

I'm trying to find a way to measure how much a person moves their finger while they are pressing on the screen.

I'm making a "mood detector" game that simulates a fingerprint scanner, and the idea is that the more a person moves around the more restless or anxious they are.

So I've tried some things with values that change based on "last touch X" and "last touch y" but I can't quite figure out how get to a final value that would accurately depict how much the person moved their finger. Any ideas?


#4

https://c.gethopscotch.com/p/y8xoctuj6
Here is the project/code

When the iPad's pressed you must keep your finger perfectly still
Any small movement is measured and will show
You can copy this code if you want to.
I don't need any credit


#5

What the hay :00

how did you tag me???


#6

Are you wanting to measure the distance the person's finger is from the originally pressed spot or to measure the total distance the person's finger moves (ie, the path length) while pressed?


#7

The second one, the total distance (path length) the person's finger moves.


#8

Ok, you'll just need to take a number of samples for a set period of time. Each sample will compare the Last Touch spot to the location of the Last Touch at the previous sample. This will give a number of segment lengths. Keep a running total and you'll have a "path length". The faster the sampling the more accurate the length will be.

I'll put together a sample project in a couple hours to demonstrate if you'd like.


#9

I found this interesting so I went ahead and made an example project:
Fidgety Finger (Edit: the webplayer doesn't work entirely right)
Or search under ThinBuffaloSr in Hopscotch
(Credit to @Stradyvarious for the name)

Add a When 'Timer Done' = 1 event to any object for any additional code based on the distance moved, eg your "mood" conditionals. The distance moved is in a variable named, obviously enough, Distance.

Tag me if you need any explaination. Have fun.


#11

You did the project properly.
Kudos (whatever that means) to you


#12

I don't know about "properly". Just different. :wink:

Your's was a fine example of finding how far one's finger moved from the original location after a set time. [Although instead of adding the Dx + Dy, we should use pythagorean theorem and use sqrt(Dx^2 + Dy^2) to calculate the "diagonal distance"]

There's always more than one way to do something. :blush: