I am still struggling a little bit with what to put where between the PlayerController and a Pawn. I understand the basic difference (The Controller controls, the pawn executes (who would’ve thought)), but I am still unsure what exactly gets put where.
Here’s two problems/examples I am confused with:
-
I am currently working on a game similar to a RTS, with a camera that can Fly around the Map and control different Pawns/Actors. Initially, my Idea was to only use a PlayerController for this, since it literally only does exactly that, control. The other argument for using the PlayerController is that it supports GetHitResultUnderCursor, which is needed for obvious reasons. However it seems like you cannot spawn a PlayerController by itself, it needs the Pawn, even though the usual arguments for using a PlayerController together with the Pawn don’t apply here either, since there will not be any possessing different Pawns or networking the Pawns. Since I cannot use the Pawn on it’s own either, it seems like I always have to use the two in tandem. Is my take on making this controller correct? Do I always have to use the two together, even when I am not using a classical Pawn?
-
In one of the official UE tutorials, they show how to move a Character using the AddMovementInput Function, with the Controlled Pawn as the Target. After following this, I tried to Rotate the camera with mouse inputs, by using the AddControllerYawInput function, again setting the Pawn as the Target. This however did not work. I tried using the exact same Function on the Pawn itself and behold, it works. I am guessing that I simply have a wrong understanding of how this function works, but why does it only work this way? What would be the correct way of rotating the Camera on my Pawn? (I mean except by using the same function but casting to the Pawn or simply passing along the parameters and executing locally)
I would be thankful for any explanation.