Download

Checking for Touch and Drag to multiple points?

Re-posted the Topic in the Visual Blueprint Scripting Forums, which is located here:

https://forums.unrealengine.com/showthread.php?13510-Mobile-Checking-for-Touch-and-Drag-to-multiple-points

Original post here:

Sure you can do it in blueprints
and there are some ways to do it, i will say one that probably is not the best.

1, know the position of your finger
You can use a node called " get input state touch"".
as input you have to say wich finger-N and it will output X and Y of your touch based on the screen size.
2, Get viewport size!
is a node that tell you the size of the screen you have, every smartphone have his own resolution so you have to know it.
3, Define an array for the positions of the points of the rune.
You know how to make a variable for store a position like XY ?
lets say we use a vector, and we just dont use the Z ok?
set it as array, and compile, now go in detail of vector and add 5 items, one for every point of the rune.
These X and Y will need to be the location of your point of the rune but be careful.
4 define another integer VAR_Reached_point To set when you reach every point.
you basically set this to 1 once start.
check for the Vector_array , using as index the VAR_Reached_point,
Check input state touch XY are look like the Vector position, if yes , add 1 to Reached_point , otherwise keep waiting the player move right in the point

Once you start to draw the rune touching the screen.
you have to put in relation the screen size, and the location of the runes-point.
basycally you have to put on a % relationship.

6:Depend of how you build up your runes and all.
Lets say you use a widget to show the rune on the screen. (just create a widget with an well anchored image)
Your rune will always be in the middle of screen, and will be resized to fill at best of screen.
For every divice, these points will be at different X, Y. (do you follow me?)
even a point in the perfect middle of the screen will be , for every device , his resolution / 2 .
So this is the exact relationship that you have to build.

Build yourself an imaginary grid, to put in relation the
Input state touch X Y, (that is different for every device) like 1/20 of screen is a universal misure.
with the screen view (that is different for every device)
use an array of vectors to keep track of positions
use an integer to define wich position of the array you want reach/ check