Download

How to disable a specific character's movement key momentarily?

Hello and sorry to bother y’all here… but… with AnswerHub dead I had nowhere else to turn… so… ehm… Is there any way i could disable a specific movement key from my FPcharacter?
I’m trying to do something like the chapter “Backwards” from “The beginner´s guide” [reference link below]

What im trying to do, specifically, is to disable the ‘W’ key when the player enters a specific area (in this case, a Trigger box) so that the only way to move “forward” is by walking “backwards” with the ‘S’ key.
(I guess I should be able to also disable the ‘A’ and ‘D’ so that there leaves no other option to the player but to walk backwards).

I know I could manipulate the inputAxis moveForward from my FirstPerson BP, in fact, I use that in another part of the level to “invert” ‘W’ and ‘S’ by multiplying the axis value by -1; but that doesn´t give me any option about the specific keys. So naturally, if i disable that (or I multiply it by 0) both the ‘W’ and the ‘S’ key stop working.

Thank you so much in advance.
Have a great day :slight_smile:

The beginner´s guide - Chapter 2: Backwards

In your PlayerController, there is an event for Input Axis Move Forward (or something like it.)
Add a Boolean for “forward movement disabled,” and in the handler for that input event, if the flag is set, calculate the axis value as min(0, value) – e g, only negative or zero values are allowed.

Oh my god… That works flawlessly (as far as I tested).
Thank you sooooo much, that was a really smart move… THANK YOU.