Use the PlayerController as the “god” controller, which doesn’t actually possess your pawn/character in question. Create your custom AIController (derived) which does what you desire to actually possess the pawn/character and perform the AI tasks needed. Then from your custom PlayerController, interpret the actual player input, and send the corresponding commands to the custom AIController which controls the character in question, and the custom AIController should be driving your character and be “smart”.
So, taking the ThirdPerson template as an example:
- Make sure that your GameMode DefaultPawn is set to “SpectatorPawn”, so no actual character will be spawned and possessed by your PlayerController
- Make sure the “Auto Possess Player” property of the character on the map is set to “Disabled” from “Player 0”, so the player will not be possessed by PlayerController_0
- Make sure “Auto Possess AI” is set to “Placed in World or Spawned”
- Make sure the “AI Controller Class” is set to your custom AIController which drives the character in a smart way
- Your game logic should enforce some kind of ownership (possessing != ownership), so your PlayerController still “controls” (or owns) the character it wishes to send command to. In case of multiple characters are “owned” by one controller, you might also want to enforce the concept of what are the “currently” active characters to receive PlayerController commands. Enforce the binding, so the PlayerController maintains a list of owned characters, and currently active characters, so PlayerController knows who to send commands to
- Sending commands basically means invoking the currently owned and active characters’ respective custom AIControllers’ events/functions - things like move to destination, or "forward key is pressed, keep moving forward)
- Once the character reaches the destination, its AI controller’s associated behavior tree will be able to play your pretty looking animation.
Done!