Swipe motion accuracy

I am trying to use a swipe motion to launch an object in an arc. How can I factor in the accuracy of the swipe into the accuracy of the launch? Like if the swipe pulls right, the launch pulls right. If the swipe pulls left, launch pulls left. Swipe is dead straight, the launch is dead straight? Similar to the way like a Pokemon Go swipe works. I’m guessing I need to somehow read the swipe, then add some force or impulse to the velocity to get it to pull left or right. But I’m not sure how to read how the swipe behaves to translate it.

I don’t know how to do swipe gestures in Unreal but I do know how to track the touch start location and the touch end location, and you can subtract one of those vectors from the other in order to get usable numbers, Y component of the vector is screen coordinate you can conceptualize as the forward or upward swipe motion, and X for the side to side.

It won’t be a direct ratio between screen coords and world coords, especially at different screen resolutions though so you’ll want to use some normalizing function nodes to make it work the same on all devices. Sorry I can’t remember the names of them.

Whether you use that approach or not, you can find the deviation between two vectors (for example the straight dead-on direction toward the target and the direction the user swiped) by feeding them both into a dot product node.

Dot product takes two vectors and returns a value between -1 and 1, where 1 is exactly parallel, 0 is perpendicular and -1 means they face opposite directions.