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!