Measuring the distance between player touching screen and releasing to determine velocity

I’m wanting to create a mobile prototype in which the player will throw objects into holes using a basic swipe up on the touch-screen device. I’m just wanting to know the best way I can calculate the distance between the initial finger touch down and then release and put this towards determining the velocity of the projectile?


UTC has a good Swipe gesture with start location, end location, direction, elapsed time and swipe direction. I was thinking about the same thing you are talking about i just haven’t gotten to it yet. So i was thinking of using the elapsed time pin to multiply velocity.

This is inside PlayerCharacter Blueprint. I have this set up to detect if the touch starts at the character meshes Screen position( there is world position too but it returns different values than screen position) If it is true it spawns an actor at that location with a velocity and direction that u swiped in. after i saw your post i went ahead and updated it so that the quicker you swiped would set the velocity higher.

what you are probably looking for would be the elapsed time on the UTC Swipe Gesture Success. you gotta right click and break apart the pen on this event component to find it. then use a break timespan node to break that pin farther. Your can see that i divided fraction nano by 100000000.0 this is to get it into a workable decimal range then you can round that out to an integer. That will flow into the switch on Int node i have it set up from 0 to 9 so if it takes you 00100000 nanos it will round to 0, if it takes you 46000000 nanos it will round to 5 ,ect . Here i Made a SwipeSpeed Vector Variable. The switch on int sets this variable in inverse proportion to swipe speed otherwise when you use this varable to multiply your velocity the faster you swiped the slower it would be. Hope this helps Good Luck.