How to cancel opposite inputs with Enhanced Input

Is there an official or best practice way to cancel opposite input with Enhanced Input?

I mean when using WASD to move around, I want W and S to cancel each other and same for A and D. What happens when I follow the official documentation is that one of the keys has priority when both are held at the same time (it seems to be the lowest one in the list of bindings (highest index)).

I have a functional workaround which is to create a different Input Action to bind to the “Negate” keys, but it just feels wrong and messy.

Thanks in advance!

1 Like

Sorry I just saw your reply, I thought I would get an email.

Axis mapping is not a thing with Enhanced Input. Axis and Action mappings are deprecated in 5.1.

EDIT: This is with my workaround, obviously I would prefer to avoid having the IA_MoveNegate Input Action and do everything in IA_Move

Here are my Input Mapping Context and movement Input Actions if that helps:

1 Like

That’s what I had before that was not working. I just tried it again using the exact same order you have with the same results.

When I hold A and D together, it goes on the right. When I hold W and S together it goes back. If I reorder D before A and S before W it does the opposite.


Ok thanks a lot in any case! For what it’s worth, the documentation pretty much says to do exactly what’s in your screenshot.

1 Like

edit; My mistake, i got confused:D

In case you didn’t solve it, I think I’ve found the solution:

1 Like

Pretty similar to what I did with the IA_MoveNegate action (which I prefer to having even more input actions). Thanks for looking into it!


What was your solution?

I made a different Input Action for the bindings with the “Negate” modifier, so basically the left and down together. You can see how I did in the screenshot from my first reply: How to cancel opposite inputs with Enhanced Input - #3 by D00rOpener

I would still prefer not to need to do that, but I stopped looking into it. It seems like the best solution at the moment.


I see. Yeah the only difference between these solutions is semantic. Yours uses 2 input actions, “positive” (forward/right) and “negative” (backward/left), whereas mine uses the 4 cardinal directions.

Effectively they work the same.

I haven’t dug into the actual distribution of IA_Move enough to know if there is a “1 input action” way to solve this problem, but as it makes no practical difference to me, I think either of the 2 solutions works fine. Certainly well enough for my purposes. :+1:


I know this thread is really old, but here’s the answer anyway:

To fix this, open your Input Action and set the Accumulation Behaviour variable under the Advanced dropdown to Cumulative.


Thanks for the solution Dillan!!!