Download

Drag action on mobile

Hi,
I am having an annoying problem with my game controls (UE 4.20.2).

For a central part of my game, I need the functionality to drag a map to select a level.
By now, I have realized it the following way:

  • When the widget has been clicked, the mouse position is being stored.
  • At every tick the actual mouse position is read and the difference to the last mouse position is being calculated.
  • The camera is moved against the difference
  • The actual mouse position is being stored for the next tick

You see: fairly easy and it works like a charm with the mouse.
Unfortunately my game is for mobile, and there is no mouse position (I get the position 0, 0 ).
I have tried to use the get input touch state node, which delivers the position 0, 0, even on a real mobile device.
I have tried to use *convert Mouse Location to world space *node, but that doesn’t seem to update the mouse position, when the button is pressed.

I hope for a hint, what I did wrong or how i could handle this problem.

Regards
Christian

Just this morning I found the Get Hit result under Cursor node, which unfortunately doesn’t update, while the button is pressed.
There is a get hit result under finger, too. But I didn’t test it on mobile device, yet. To be honest, I don’t expect any different behaviour.

Weirdly, in a tutorial they use exactly that node for updating the mouse position while it is pressed. That means, I have done something wrong or I missed something.
Can anyone please tell me, what it may be?
The tutorial: https://docs.unrealengine.com/en-us/Resources/ContentExamples/MouseInterface/BlueprintActors

Regards
Christian

Really, no idea?
Sorry for pushing :wink: