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

If you map them as axes they should cancel themselves by default, can you post a screenshot of your input mapping?

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:

I didn’t know you were using 5.1, by the way, the logic is the same!
You have to put them in the same group and use Negate:

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.

1 Like

Man, I’m sorry but you are right! I was using an old project updated to 5.1 and it was still using the old input mappings, that’s why it wasn’t bugged.
I created a new project and I can reproduce your issue, I’ll try to dig deeper!

1 Like

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