Hello. After doin some tutorials and using premade templates i decided to do everything from blank template. I set up an actor which looks like a sphere, a camera, all working up to this point. So i tried to send input commands to my character. And here comes my question:
Whats the differnece between setting up SetupPlayerInputComponent in Pawn class and from using separate PlayerController class? And is there any difference with playercontroller for Pawn class and Character class?
I did separate class and it indeed takes input (i put messagebox to pop when the command is received and it shows up) but it seems like it does not transfer the commands to the character (charcter should move to the hit location, or change camera rotation). I got everything set in gamemode
Decision whether to implement input in Character (or Pawn) class or in a separate Player Controller class depends on the situation.
If you want to implement some complex input functionality (for example if there are multiple players on one game client or there is a need to change characters dynamically at runtime), it is better (and sometimes necessary) to use Player Controller. In this case, Player Controller handles input and then issues commands to the Pawn.
For example, in deathmatch games, Pawn may change during gameplay, but Player Controller usually remains the same.
Pawn is the base class of all actors that can be possessed by players or AI. Characters are Pawns that have a mesh, collision, and built-in movement logic.
If your input is not complicated and there is no need to change character dynamically at runtime, Character class is more suitable. For example, you can use it in single player first-person shooter.
As for your code, please make sure that your Character is possessed by the Controller. For this, you can use APlayerController::Possess function, which handles attaching the controller to the specified pawn: