# Getting screen resolution independent swipe/drag distance

**URL:** <https://forums.unrealengine.com/t/getting-screen-resolution-independent-swipe-drag-distance/341993>\
**Category:** Community & Industry Discussion\
**Tags:** swipe, resolution, distance, unreal-engine, runtime, question\
**Created:** [December 20, 2015, 3:55pm UTC](https://forums.unrealengine.com/t/getting-screen-resolution-independent-swipe-drag-distance/341993 "2015-12-20T15:55:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![applepiefrost](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@applepiefrost](https://forums.unrealengine.com/u/applepiefrost)\
**Post date:** [December 20, 2015, 3:55pm UTC](https://forums.unrealengine.com/t/getting-screen-resolution-independent-swipe-drag-distance/341993/1 "2015-12-20T15:55:34Z")

</div>

I’m building a very simple basketball game where the player will launch a basketball based on a swipe/drag. I can get the start and end point of the swipe, as well as the time it took to complete. I use distance over time to get the speed and use that value to build a vector to launch the ball.

The problem I have is the following:

On a device with a resolution of 1280x720 the pixel distance of the swipe is different than on a device with a 1920x1080 resolution. On a device with a higher resolution, the player would have to do a much shorter swipe.

What I would like to do is get the screen resolution so I can divide the pixel distance by the screen height. That way it would work the same for any resolution.

So my question is:

- Is there a way to get the screen  
resolution at runtime? The Viewport  
Size node only works in-editor.
- Is there another or better way to get  
a resolution independent solution?

One thing I haven’t tried but will give a shot is:

- Parent a collider to the camera

- Get the world space coordinates from the screen space location of the begin and end of the swipe

- Use that distance to do the rest.

I’m guessing that way it would also work on any resolution, but somehow seems a bit hacky?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_95457204](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_95457204](https://forums.unrealengine.com/u/anonymous_user_95457204)\
**Post date:** [January 12, 2018, 6:49am UTC](https://forums.unrealengine.com/t/getting-screen-resolution-independent-swipe-drag-distance/341993/2 "2018-01-12T06:49:05Z")

</div>

Hi there,  
did you find a solution to your problem? And would you please mind sharing your solution, that woud be appreciated?  
Thanks
