Hi! I am trying to disable the “W” key when I enter a trigger. First, I created a bool variable in my player character. Then I added a pressed key “W” and connected it to a branch, followed by bringing in the bool variable and connecting it to the branch. I did make the bool variable set to true but where I get lost is that I am not sure what I am connecting to the True and False to disable the W. Also, is the bool variable and branch supposed to be created in he player controller instead?
Then in my level blueprint I have the Begin Overlap for my trigger, followed by Cast To my player character, and then have my Set bool connected to my Cast. Still nothing works works and I am completely lost as to why. Can anyone please help me by showing me an image(s) of what what they did to get something like this working? It would be greatly appreciated. Thank you!
Am I doing it correct when I am using the Cast To in my level blueprints? Also, should I be doing this in my Character blueprint or should this be done in my Controller blueprint? I am bit confused by what you mean when you say “just run your logic”. Sorry for all the questions, I have been stuck on this for so long.
If anyone knows the easiest way to set this up using the First Person Blueprint with 5.6, that would be extremely helpful. Any images would also be helpful. Thank you!
well by disabling W i assume you mean disable the logic that comes after W. So lets assume that is MoveForward. if you put MoveForward on the true path and Set CanMove to false then it wont fire.
I actually just want to know how to disable any key when entering a trigger but I am using “W” as an example because I do want to stop the player’s forward movement.
I have looked everywhere and I haven’t been able to find one solid example of how to do this or any video regarding how to disable a single key input during gameplay.
Thanks for the response. I understand what you are saying but I don’t know what that would look like in Blueprint. Do you have a way of showing me what that looks like? Thanks!
First of all what I recommend for testing all of this is to use Print Strings so you can see exactly when it’s being called.
To disable a key there isn’t a node that literally “turns it off.” What you’re really doing is disabling the logic that runs behind that input. You could do this with branches, but if you want a cleaner and more scalable solution, the recommended way is to use Input Mapping Contexts (IMC) in Enhanced Input
( Documentation : Enhanced Input in Unreal Engine | Unreal Engine 5.6 Documentation | Epic Developer Community).
The cleanest and most scalable way to disable a specific key (like W for forward) is through IMCs. What you do is duplicate your default IMC (for example, IMC_Default - IMC_DisableKey) and in that copy remove the binding for the action you want to disable. In this case, that would be the forward movement action bound to W.
(IMC Without specific key )
From the Level Blueprint (or from your Bluepint ), you simply call DisableKey Event when the player enters a trigger and EnableKeyEvent when they leave, or at any other point where you want to toggle the behavior.
(Blueprint with a trigger)
The advantage of doing it this way is that your gameplay logic stays clean and separated from input logic. Instead of filling your Blueprints with branches and condition checks, you just switch contexts. This also lets you create different “control profiles” and scale the system easily without conflicts.
In case you want to disable it using a Branch, here’s a link where they talk about the topic, so you can better understand how it works:
And lastly, in case you want to know where the movement logic is and how to disable moving forward and backward, I’m leaving you an example with a Select and an Enable/Disable Forward/Backward . This disables the forward and backward movement logic whenever the player overlaps with the trigger, and re-enables it when exiting the trigger.
@BRGEzedeRocco@Rev0verDrive Thank you so much for your detailed responses. This will not only help me but the others out there that may also want to implement this. Thank you, thank you, thank you!