# Help with stoping key press

**URL:** <https://forums.unrealengine.com/t/help-with-stoping-key-press/2655142>\
**Category:** Blueprint\
**Tags:** unreal-engine, question\
**Created:** [September 9, 2025, 4:13pm UTC](https://forums.unrealengine.com/t/help-with-stoping-key-press/2655142 "2025-09-09T16:13:46Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ddave104](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ddave104/32/1000318_2.png) [@ddave104](https://forums.unrealengine.com/u/ddave104)\
**Post date:** [September 9, 2025, 4:13pm UTC](https://forums.unrealengine.com/t/help-with-stoping-key-press/2655142/1 "2025-09-09T16:13:46Z")

</div>

Im trying to stop the player from moving left or right sometimes during my game. Is their a way to block/ pause/ stop the key press for a short period of time?

---

<div class="post-metadata">

**Author:** ![laggyluk](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@laggyluk](https://forums.unrealengine.com/u/laggyluk)\
**Post date:** [September 9, 2025, 4:26pm UTC](https://forums.unrealengine.com/t/help-with-stoping-key-press/2655142/2 "2025-09-09T16:26:56Z")

</div>

you can call ‘set ignore input’ on player controller

---

<div class="post-metadata">

**Author:** ![LemontreeSoftworks](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lemontreesoftworks/32/1097595_2.png) [@LemontreeSoftworks](https://forums.unrealengine.com/u/LemontreeSoftworks)\
**Post date:** [September 9, 2025, 4:46pm UTC](https://forums.unrealengine.com/t/help-with-stoping-key-press/2655142/3 "2025-09-09T16:46:49Z")

</div>

You should not fiddle with the input system, but rather stop processing the input, e.g. if there is an obstacle in the way.

So (pseudocode):

```c
OnKeyPressed()

    if Player.IsAbleToMove
       Player.MoveLeft()
    else 
       DoSomethingElse()

```

---

<div class="post-metadata">

**Author:** ![ddave104](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ddave104/32/1000318_2.png) [@ddave104](https://forums.unrealengine.com/u/ddave104)\
**Post date:** [September 9, 2025, 4:52pm UTC](https://forums.unrealengine.com/t/help-with-stoping-key-press/2655142/4 "2025-09-09T16:52:27Z")

</div>

I put this for blueprint

---

<div class="post-metadata">

**Author:** ![BRGEzedeRocco](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/brgezederocco/32/1216890_2.png) [@BRGEzedeRocco](https://forums.unrealengine.com/u/BRGEzedeRocco)\
**Post date:** [September 9, 2025, 8:03pm UTC](https://forums.unrealengine.com/t/help-with-stoping-key-press/2655142/5 "2025-09-09T20:03:10Z")

</div>

Hello @ddave104,  
You can try doing something like this:  
First of all, in your BP\_Character create a Custom Event called BlockLeftRight and a boolean variable called BlockMoveLeftRight. In the event, set the variable to true to block lateral movement, then add a Delay with the duration you want, and after the Delay set the variable back to false to re-enable normal movement.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/8/b/18b06d06bc49d32cbbb41a48652fbc2ffb1b7b21.png)

Then, in the Move function, which is in the Functions section on the left side of the Event Graph, add a Branch with the condition BlockMoveLeftRight. If the condition is true, allow only Forward/Backward movement, and if it is false, allow both Forward/Backward and Left/Right.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/d/3/bd30039e8bb0e3614e50dcb17cc46eeaca81f74b.jpeg)

In my case I tested it with a Blueprint that has a Trigger Box: when the character enters the trigger, it calls the BlockLeftRight event, but you can call it from anywhere you need.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/c/b/6cb082acc50f94912c15fa6220429f3ba2cdb378.png)  
Hope it helps!

---

<div class="post-metadata">

**Author:** ![ddave104](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ddave104/32/1000318_2.png) [@ddave104](https://forums.unrealengine.com/u/ddave104)\
**Post date:** [September 10, 2025, 8:59pm UTC](https://forums.unrealengine.com/t/help-with-stoping-key-press/2655142/6 "2025-09-10T20:59:42Z")

</div>

Hi, this is a great code, but not the code I’m looking for. This is just blocking I’m looking to stop the person/player input, this is just blocking the character. Thanks anyway

---

<div class="post-metadata">

**Author:** ![BRGEzedeRocco](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/brgezederocco/32/1216890_2.png) [@BRGEzedeRocco](https://forums.unrealengine.com/u/BRGEzedeRocco)\
**Post date:** [September 10, 2025, 11:23pm UTC](https://forums.unrealengine.com/t/help-with-stoping-key-press/2655142/7 "2025-09-10T23:23:35Z")

</div>

So you could try the following:  
First create an **IMC( Input Mapping Context)** and remove the inputs you don’t want to use, in this case the **A/D** and **Left/Right** keys.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/d/f/7df2b93f82685fb7beb93789f58b705815459263.png)

Then, in the **Player Controller** , set up a **Custom Event** :

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/e/5/6e5157b0a25b0bdc2c872c57e8d61c15d2827ab4.jpeg)

This logic remove the default IMC and add your customized one, and after the desired amount of time re-enable the default IMC.

In the **BP\_Box** , for example, it would look like this

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/4/3/c43e7faaa1d5dea00b5082a51b18676e80210d04.png)

Is this what you were looking for?

I’m also leaving a “cleaner” way to set up the logic from the previous post

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/0/28043f636a9fa1dba1553ccd4688b51625ca1574.png)

---

<div class="post-metadata">

**Author:** ![LegendGary](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LegendGary](https://forums.unrealengine.com/u/LegendGary)\
**Post date:** [September 11, 2025, 2:23am UTC](https://forums.unrealengine.com/t/help-with-stoping-key-press/2655142/8 "2025-09-11T02:23:42Z")

</div>

What games are you making? like do you have up and down input or just left and right?

---

<div class="post-metadata">

**Author:** ![ddave104](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ddave104/32/1000318_2.png) [@ddave104](https://forums.unrealengine.com/u/ddave104)\
**Post date:** [September 11, 2025, 3:16am UTC](https://forums.unrealengine.com/t/help-with-stoping-key-press/2655142/9 "2025-09-11T03:16:49Z")

</div>

Third person game up, down, left, right. But when the character steps on top of a trap the character movement changes or just stop working. Like it’s confused

---

<div class="post-metadata">

**Author:** ![illspiritx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@illspiritx](https://forums.unrealengine.com/u/illspiritx)\
**Post date:** [September 11, 2025, 7:45am UTC](https://forums.unrealengine.com/t/help-with-stoping-key-press/2655142/10 "2025-09-11T07:45:27Z")

</div>

To trap character, easiest thing to do would be use Ignore Move Input on overlap, then reset it with a timer:

 ![movementtrap](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/d/0/1d0d8c57ce3f27d1e733452c2d7159528f9e380f.jpeg)

Should work on NPCs too if need be.

---

<div class="post-metadata">

**Author:** ![BRGEzedeRocco](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/brgezederocco/32/1216890_2.png) [@BRGEzedeRocco](https://forums.unrealengine.com/u/BRGEzedeRocco)\
**Post date:** [September 11, 2025, 5:39pm UTC](https://forums.unrealengine.com/t/help-with-stoping-key-press/2655142/11 "2025-09-11T17:39:13Z")

</div>

To achieve the trap effect, you can use Input Mapping Contexts (IMC) from the Enhanced Input system.

An IMC is basically a list of your Input Actions (move, jump, etc.) along with the keys that trigger them. The advantage is that you can have multiple IMCs and switch between them at runtime.

What you need to do is duplicate your IMC\_Default and create an IMC\_Confused. In this new context you use the same actions but inverted (for example, A = right and D = left). If what you want is that the character cannot use those keys at all, simply remove those entries from the IMC.

IMC\_Default

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/4/b/94b19ecd0adb284269faba1cb81ac49600469b54.png)  
IMC\_Confused  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/5/a/b5a6333944927382dced0f0d4c7fca56ca494ad0.png)  
IMC\_Block/ignore  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/b/e/1be8a881060a8c7d5d48fefc8a61b08f52337be4.png)

In the Player Controller you already have the event set up (the one I showed in the previous post) and its logic is as follows:

- Remove the IMC\_Default (the basic controls).

- Add the IMC\_Confused (the modified controls).

- Wait for the number of seconds you define.

- Re-enable the IMC\_Default.  

To call this event from the trap, use a Trigger Box. In the Event Graph, with the OnActorBeginOverlap event (which fires every time the player collides with that Box Collision), cast to your BP\_ThirdPersonPlayerController and from there call the event in the Player Controller that switches between IMC\_Default and IMC\_Confused.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/a/1/0a1922589484fd5201a9b3738682d8e722ce09ed.png)

This way, when the character steps on the trap(box collision), their controls are inverted or disabled temporarily, and then return to normal.

Here’s some documentation on Enhanced Input and Input Mapping Contexts

> **[Enhanced Input in Unreal Engine | Unreal Engine 5.6 Documentation | Epic...](https://dev.epicgames.com/documentation/en-us/unreal-engine/enhanced-input-in-unreal-engine#dynamicandcontextualinputmappings)**
>
> An overview of the Enhanced Input Plugin in Unreal Engine

If this isn’t exactly what you’re looking for, could you share a bit more about what you’d like the trap to do or how it should work?
