I’m struggling to get my head around what logic should be in a player controller and what logic should be in a pawn. Looking at the UE4 manual it says “the PlayerController decides what to do and then issues commands to the Pawn” giving examples of jump and start crouching.
Say I want a pawn to jump… would I have the key press be in the PlayerController which then immediately runs a custom event or a function that holds the logic for the jumping in the pawn? How do I get the players will to issue commands to the pawn? What would the command be in this case? I just think seeing something really simple would help wrap my head around the concept of player will and commands.
Technically the “controller” should contain everything common to ALL possible controlled pawns. So if every pawn you have can walk, run, jump then have those events in your player controller. If only 1 pawn can fly, then you should have flying behavior either in a separate controller for flying pawns that you will switch to when in a level where you fly OR put that within the flying pawn BP and the player controller will maybe have a small sub-section of commands it can issue to a flying character. So the controller will handle the “input” from the player. So when the “Space Bar” is pressed do “X”. If all pawns do the same thing when you press “space bar” like “jump” then script that in the controller. If each pawn does something different when you press the space bar like a unique “Attack” then script that specific logic within the pawn and have the controller call an interface event in the controlled pawn and that way each pawn can have their own attack, but ALL pawns will attack when space bar is pressed. This way the controller only contains code common to ALL pawns while each pawn individually would contain code unique to itself.