I’m having a problem where my one of my keys (and axis mapped one) gets stuck at an axis value of 1.0 even when entering a UMG widget, so my character keeps moving even after I close the widget.
The ideal solution would be to set the value the axis mapping returns to 0.0, but there is no way to actually set that value by force or force the key to be released so it resets.
I’m using an axis mapping for both keyboard and controller, that’s why I can’t go with an action mapping. Both WS & Left-stick up-down are assigned to MoveForward for example.
The problem here is that if for example W is pressed, obviously I get an axis value of 1.0, so my character moves forward. Then if I open a UMG widget while moving (I use Set Input UIOnly node to focus on the widget), the game stops focusing on my controls and keeps walking on while the menu is opened, which is not what I desire. The reason why this happens is because MoveForward is outputing 1.0 because the key is pressed, but after the menu is opened it no longer detects if the key is changing its state, so even after releasing the key or exiting the menu, it will still output 1.0 which is problematic.
What I’m aiming for is just to have the character move and if the menu is brought up, stop the character’s movement and keep it like that until you’ve exited the menu.
Thanks for the pretty example but I think you’re not understanding what’s the real problem. Even if I did what you just posted, the problem would still be the same.
The deal here is that the moment you enter in UI mode Only, the axis mapping doesn’t go back to 0.0 unless it detects the key has been released, which it can’t because it’s in UI mode (no longer detecting key presses handled by the player itself [Game Mode]). When the input enters the gate, it will still receive a 1.0 output because the axis mapping hasn’t been reset to 0 again.
If you want to see what I’m talking about, create a new template project, 3rd person template.
It should come with basic controls like this:
The widget just needs to be a text to show that it’s running. Now try to run and while running press K and you’ll see the problem.
If after that you still think that the gate system solves it. Implement a button for exiting the menu and you’ll see what the real problem is.
That’s what I was doing to begin with. Try with that setup you just posted to do this: Move -> Open menu -> While menu is opened release the key you pressed to move (W for example) -> Close the menu
That way you’ll see what’s the problem behind it. You can stop it from moving before the menu opens, but after you close it and return the control to the player, the player will start moving because the axis is set to 1.0.