Download

"Get Mouse Position" returns 0,0 unless focus changed

This is blueprint to print out mouse position every time a click occurs. The graph is for a “picture” widget used as a background, on which there are a few buttons.

This works fine when played in viewport but will only print out 0:0 when run in “mobile preview” or on a real android phone, unless I click on a button then click on the picture background.

Any suggestions?

Thank you

Try it like this:

Screen Space should be self-explanatory, and Local will return coords inside the clicked widget. Unless you click on a button that will hungrily consume the input…

The player controller is confused while the widgets are handling input so I wouldn’t ask it about mouse position.

1 Like

Thanks for the suggestion. I have changed the graph accordingly and now get “almost” correct coordinates.

What I’m testing is to get “x,y” from the clicks/touches then simulate a tap on this position via “adb” on an android phone.

The “y” value used by “adb” to trigger a tap is very close to what’s from the mouse down event in UE. However the “x” value used by “adb” is about 120 larger than that from the mouse down event. This android phone has a camera hole on the top and the UE app UI stops at the edge of the camera hole. I suspect that’s why the width of the screen used by UE is a bit less than the screen width.

If so, is there a way to calculate how much that offset is, or a way to force UE game to occupy the whole screen even if the UI covers the camera hole?