UMG Border OnMouseMove not reacting well in Android

Hello,

I’m making a SideScroller, and I’ve been trying to set buttons in a way that, whenever I have my finger touching them, the character moves. That includes switching between movement keys whithout having to stop touching the screen. I’m on the 4.6.1.

When setting Buttons, I couldn’t make it work, and then I tried it out with Borders, as they come up with easily binded events of OnMouseButtonDown/Up, OnMouseMove.

So, having a binding in the OnMouseMove resulted in a quick, easy way to do what I wanted, and it works great when playing the Mobile Preview and having the cursor enter, stay and leave the Borders, even when I’m not moving it at all.

  • However, when I launched it up in my mobile device (Sony Xperia Z1), I’m having a lot of troubles. My finger is sometimes halfway into the Border, moving it all the way up and down, but the character doesn’t react at all.

Is this a wrong way to catch the player Input? Am I missing something about the Borders properties, thus having troubles detecting touch input?

There is only one mouse cursor, so using OnMouseMove() seems inappropriate for mobile anyway; you could only support one finger. I have not tried the following myself, but here is how I would go about it:

  • Make a new Widget Blueprint for your VirtualButton button. Call it UMyVirtualButton.
  • Add a parameter telling the virtual button what action it is meant to control.
  • Add implementations for OnTouchStarted() and OnTouchEnded(). (You will have to switch from Designer to Graph. Then right click on the function names and select Implement Function.)
  • OnTouchStarted() you should start performing the desired action. Also, you should reply with Handled()-> CaptureMouse()
  • OnTouchEnded() you should stop performing the desired action. Also, you should do Handled()->ReleaseMouseCapture()

Capture refers all events for that finger being sent to the button. That means, even if you move the finger off the button, the button will continue being pressed until you release it. Unfortunately, we have not had time to update our vocabulary, so we are still talking about MouseCapture when in reality it is PointerCapture. By PointerCapture we mean touch, cursor and stylus are supported.

In the future I hope to unify Mouse, Touch, and Stylus into one set of events.

-Nick

Thanks a lot for your response, I will try it out when I have time and update this answer once I get it working ^^.

Update: Hi, I’ve tested out your solution, and again, it works great when testing it in the Mobile preview, but when I launch it on my mobile device, I get a a bad response, actually, the same as before.

I also tested it out using the IsHovered() function, and got the same problem.

So, I think I might be missing out something with DPI scaling or anchors related to the button touch area in the mobile device, but after reading some documentation and further researching I still didn’t come up with any solution.

  • Do you think that last thought has any sense? I find it really weird that the touch area is not the same as the button’s display :S but again I’m probably missing something here, as that seems to be the actual problem.

Thanks for your time.

What if you modify slate application to draw the raw touch position you’re receiving, make sure it’s even over the right airspace of the buttons, then we can work through why it’s not firing events once we know it’s coming in correctly.

Okay, I’m not really sure if I understood what you proposed, but I will try to figure it out and test it as soon as I can. Thank you for your response.

Hi again!

I’ve been testing a lot of stuff, and the problem may actually be really simple, just that I haven’t noticed it before. The actual question is at the bottom, the following is an explanation of how I got to the question.

First of all, I tested my setup built for win8 in a friends’ Surface and it responded nicely to the touch input. That made me think the problem was related to my mobile device. Back at it, I started testing stuff, getting the Touch location, widget locations, etc etc.

What I finally have is an UMG widget that just contains an image (no canvas). Then, I set up everything dynamically in my character Blueprint, so that I create that widget, add it to the viewport, set it’s location… And I print the screen size and the Touch Location. Then, if the Touch Location is within the widget, I move the character a single step.

Everything works in my PC, but again, when touching the left side of the button in my mobile device, it doesn’t react. BUT… Now that I’m printing the stats, I can see that the screen size is 1200x720, with a scale of 0.666.

However, at the right side of my screen even though I’m playing, there’s still the Go Back, Go Home, and settings bar. When touching next to it, X=1192.
The fact that the bar is there may actually be the problem. When I touch the left border of the screen, X=0.0. And when moving the touch a little over the right, it still says X=0.0. It wont change until I reach some distance over the left border.
The same happens with the Y.

I’ve searched a way to remove the right bar (The Go Home, Go Back bar, I’m running Android 4.4), but haven’t found anything, and I think it probably is really simple to do so. If someone could tell me how to do it, I’ll try it out a let you know if that was the problem. Sorry for the long post!

I finally found a way to remove the navigation pane as Babcock states in this post: What is this annoying bar on my app! - Mobile - Epic Developer Community Forums!

But the problem persists. Whenever I press from the left border it won’t stop detecting an X=0.0 after having some distance withing the border. Same for Y. Now, I don’t have a clue how to solve this, but at least I know what’s the problem.

Any help is appreciated, it may be just a compatibility issue with Sony Xperia Z1 (Android 4.4.4), or a general matter when the android buttons are included as a tactile extension of the screen.

I’m sorry to bump this, but I would really like to know if there is a solution or it’s a bug and I can do nothing about it, now that I know exactly what is happening (what the error is). So that I can close this question.

Thanks.

This may be an issue with the resolution of the touchscreen, a delay before it detects it has moved enough to be treated as a move, or filtering to see if you are doing a drag to show the status bar. My post was about the SYSTEM_UI_FLAG_IMMERSIVE_STICKY flag, which lets you drag from the top or bottom (sides on tablet) to see the hidden buttons. You can try SYSTEM_UI_FLAG_IMMERSIVE with SYSTEM_UI_FLAG_HIDE_NAVIGATION instead.

Posting a video of what you are seeing, or how you set up your project may also help in seeing exactly what you are experiencing.

Hello ,

Thank you for your comment, I’ve been on a trip for a month and won’t be able to test what you’ve suggested right now. I think I’ll be able to try it out in two or three weeks.

I’ll send an update then, thanks again!

Let me know how your testing goes.

Oh I’m so sorry I actually forgot about this since I got into some other things and the project would now be PC focused.
I couldn’t try out what you suggested. If I happen to experience some similar issues in the future I’ll have your comments in mind.

Sorry again and thank you for your time!