Download

How to request "full rotation", for aiming, from the controller?

Hi folks,

I’m slowly learning the extreme basics of UE4. I’m trying to code my own first person character movement without just copying code I find. So far, I’ve got forward and back, side to side, movement working. That was pretty simply. Second, I got mouse rotation working for rotating the character itself around the yaw axis. Now, I’m trying to get vertical rotation working for mouse looking up and down.

I have it “working” currently, but I ran into a few things that make me think I’m doing it wrong.

First, without changing anything, simply rotating my character around the pitch axis did not work. Knowing that character class is meant for an upright human-like character, I figured the character class prevented that kind of rotation since it probably doesn’t make much sense. Sure enough, the character class code disables that axis. So, I just went against the grain and changed that boolean to allow rotation around that axis and now my character rotates as desired. But while in the character code, I saw the following comment right above the line that prevents that axis rotation …

https://github.com/EpicGames/UnrealEngine/blob/f509bb2d6c62806882d9a10476f3654cf1ee0634/Engine/Source/Runtime/Engine/Private/Character.cpp#L47-L48

That comment directly suggests that I should not be doing what I just did, and even explains why.

So, I’m here to ask what that comment is telling me to do?

I looked around the docs and code and don’t see anything about requesting full rotation.

I’m just trying to get a FPS style mouse look while moving around setup going. I don’t want something like DAYZ for example where you hold Alt to enable free looking.

Thanks!