# 5.3 Enhanced Input: Make two opposing inputs cancel each other out when pressed

**URL:** <https://forums.unrealengine.com/t/5-3-enhanced-input-make-two-opposing-inputs-cancel-each-other-out-when-pressed/1479617>\
**Category:** Programming & Scripting\
**Tags:** Input, unreal-engine, controls, question\
**Created:** [December 5, 2023, 6:52am UTC](https://forums.unrealengine.com/t/5-3-enhanced-input-make-two-opposing-inputs-cancel-each-other-out-when-pressed/1479617 "2023-12-05T06:52:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wheatttttt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Wheatttttt](https://forums.unrealengine.com/u/Wheatttttt)\
**Post date:** [December 5, 2023, 6:52am UTC](https://forums.unrealengine.com/t/5-3-enhanced-input-make-two-opposing-inputs-cancel-each-other-out-when-pressed/1479617/1 "2023-12-05T06:52:22Z")

</div>

Here is my input mapping:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/5/4/15452367b5be6b1950266896d4872ba1bdc22140.png)  
It’s pretty simple. Pressing “A” gives a value of `1.0`, and “D” gives a value of `-1.0`.

However, when holding both at the same time, instead of canceling out, “D” takes priority (which makes sense, as it uses the “negate” modifier).

Is there a way to make these two inputs cancel out instead of one taking priority? I don’t want to use separate mappings for each movement key, as that kind of defeats the purpose of using enhanced inputs, especially considering the old input system could do this fine.

---

<div class="post-metadata">

**Author:** ![HenryCollins1981](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@HenryCollins1981](https://forums.unrealengine.com/u/HenryCollins1981)\
**Post date:** [May 22, 2024, 11:32am UTC](https://forums.unrealengine.com/t/5-3-enhanced-input-make-two-opposing-inputs-cancel-each-other-out-when-pressed/1479617/2 "2024-05-22T11:32:01Z")

</div>

Yea, it’s pretty simple actually. I randomly came across it when I had the same issue as you.

You can just go to the “InputAction\_MoveLeftRight” asset and go to “Accumulation Behaviour” under the “Action” header. From there, select “Cumulative” rather than “Take Highest Absolute Value.” This will mean that the input will be a sum of whatever is being pressed.

i.e. If I press A (= 1) and D (= -1), the sum would be 0 (-1 + 1 = 0).

---

<div class="post-metadata">

**Author:** ![xDoMeRaSx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@xDoMeRaSx](https://forums.unrealengine.com/u/xDoMeRaSx)\
**Post date:** [September 28, 2024, 1:19pm UTC](https://forums.unrealengine.com/t/5-3-enhanced-input-make-two-opposing-inputs-cancel-each-other-out-when-pressed/1479617/3 "2024-09-28T13:19:09Z")

</div>

What should I do when I want to have the opposite of this, so that when I press A, it takes priority over D, and when I press D it takes priority over A? In my current implementation, when holding A, pressing D takes priority over A, but when holding D, pressing A wont do anything.

---

<div class="post-metadata">

**Author:** ![HenryCollins1981](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@HenryCollins1981](https://forums.unrealengine.com/u/HenryCollins1981)\
**Post date:** [October 6, 2024, 9:15am UTC](https://forums.unrealengine.com/t/5-3-enhanced-input-make-two-opposing-inputs-cancel-each-other-out-when-pressed/1479617/4 "2024-10-06T09:15:49Z")

</div>

I don’t know, sorry. You could try figuring out a formula for it, since it has to work with the input values being A=-1 and D=1. The reason why your current implementation sounds like it only works one way is because you probably have highest absolute value as your accumulation behaviour in your input action asset. What this means is that when both input values for A and D received by the input action asset, it will take the answer in absolute value (absolute values are always positive). So A=-1 and D=1 will always equal 1 as the absolute value, meaning one direction will always take higher priority over the other.

---

<div class="post-metadata">

**Author:** ![kablouser](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kablouser](https://forums.unrealengine.com/u/kablouser)\
**Post date:** [July 1, 2026, 2:51pm UTC](https://forums.unrealengine.com/t/5-3-enhanced-input-make-two-opposing-inputs-cancel-each-other-out-when-pressed/1479617/5 "2026-07-01T14:51:47Z")

</div>

In your InputAction assets set “Accumulation Behavior” to “Cumulative” instead of the default “Take Highest Absolute Value”. This is a strange default.
