Download

Input Axis Control support for Widgets

Hello people. I wrote this to answerhub and decided to write here also, just to give feedback for possible feature implementation. For a couple of days, I was trying to make input axis controls via UMG interface but so far no luck. And I watched, read every forum posts, tutorials countless times but I couldn’t see any person to do this. And then finally realized I was chasing an impossible dream. A dream that you easily put input axis control to a widget so that you won’t need that awful virtual joystick on mobile.

I think this is a huge problem because virtual joystick…well…sucks. It doesn’t have the control flexibility of the keyboard controls. I just want to control my flying vehicle with buttons on mobile.

Please Epic, in future updates, make a feature to incorporate axis inputs directly to UMG buttons. Unreal Engine’s mobile graphic capability is great, but gameplay is far more important. Please…

Talked it over with framework, the current thinking is that your game’s player controller or pawn should expose events and functions you can call from your UI to set the required game state you care about. For example, the Pawn exposes AddMovementInput. Your UMG version of the joystick would call that function to send your own movement commands to the pawn. Buttons can do the same thing, if you’ve got a punch event that can be triggered on a pawn, just fire that event on the pawn and it will do the same thing that the input bound code does.

Hi Wanderer_eternal,

I played around with this quite a bit this past week and found a way to create individual movement buttons that work with touch events.

customeventsjump.png&stc=1

In character blueprint I set up custom events for each movement type I was looking for. In this case it was a 2D platformer so I used jump, stopjump, left, and right.

&stc=1

Once that was set up, I created a widget that held 3 images. Buttons consume input so for the sake of testing I did images to prevent this from occurring.

&stc=1

In the event graph, I created a tick event that checks to see if any of the images are hovered. If that image is hovered it then checks to see if a bool has been set. This bool is set in the function “On Touch Started”. In the “My Blueprint” pane you should see these under touch input. Right click on “On Touch Started” and press “Implement Function”. In this function set a variable “Is Touched” and set it to true. Do the same for “On Touch Ended” and set the bool to false.

After checking to see if the image is touched, cast to player character and pull the specific functions (in this case right, jumping, stop jumping, and left). This worked while testing on my end, let me know if it works for you!

You can lay out the template?