UE4.21 C++ Not all keys working as input

Hi everyone!

I am new to UE4, and I am having troubles at handling inputs via C++. I have a pawn that I use as a camera for my map, and I want the user to be able to rotate this camera with WASD and to zoom in and out with mouse wheel up/down. I followed some tutorials online to do so, I didn’t realize the exact same functionalities they did but I followed their general structure and I believe my code is correct… however, some of the key inputs don’t work when I play the program and I cannot understand why this is happening.

—EXAMPLE—
One of the first times, after I compiled, the W and D keys were working and doing what they were supposed to, but A, S and the Mouse Wheel didn’t. I tried to change some things, compiled, created a new instance of my camera actor, but now none of the keys were working. So I tried to change the mouse wheel to the Up and Down arrows and I replaced W, A, S, D with U,H,J,K, recompiled, deleted the old instance of the pawn and created a new one: now only Up, Down, U and K are working.

Can some of you help me out? What is going on? I believe that the code I wrote is not wrong, maybe I am missing something, probably because I do not understand exactly how UE input management works underneath… or maybe it’s just a dumb error I am not seeing. I am attaching some code that could be useful to you, it all comes from my pawn-like class TC_Camera.cpp
This is my constructor:

Below is my input binder method; the line “InputComponent->bBlockInput” comes from the fact that I have found some people with my same problem online, but they were all programming with blueprints and apparently solved it in I way I tried to replicate via C++ by adding this line.

These are my actual input settings

These are the methods called in the input binder:

And finally this is the Tick method:

Thank you very much in advice!

Of course, the line “InputComponent->bBlockInput = false” did nothing for me, I wouldn’t be here if it did.

Ok, after almost a week in which I distracted myself working on something else, I returned on the problem and solved it, I’ll leave the solution here in case someone will encounter my same problem in the future.

First of all, the axis mappings should be done like this:

286604-axismappings.png

Let’s say you want to implement horizontal rotation for your camera. I don’t know why but apparently if you create 2 different axis mappings, one for clockwise and one for counter-clockwise rotation as I did previously, the code compiles but only one of the two mappings, in my case the last created, works. Instead, you should create a single mapping for the rotation, like “HorRotation” in the image above, and add two different keys to it: one will have scale -1, and the other +1. It would be fantastic if some UE4 pro could explain to me why the first solution doesn’t work while the second does, but I have very little faith someone will ever answer me; however, I suppose it has to do with the fact that in the first case, the last created binding overrides the first one at runtime.

Now, about the mouse wheel problem, I was completely off the track: I was trying to create two ACTIONS mappings, one for mouse wheel up and one for mouse wheel down, which didn’t work. I solved it by creating an AXIS mapping instead and using only “MOUSE WHEEL AXIS” key instead of “mouse wheel up” and “mouse wheel down”, see the image above. Again, I don’t understand why UE4 is happy with mouse wheel axis and what is wrong with mouse wheel up and down, if someone with more experience than me has time and want to explain it to me, it would be great.

Now my SetupPlayerInputComponent method looks like this:

286605-setupplayerinputcomponent.png

While the functions are:

286606-functions.png

And, finally, this is how the Tick method works