How should AIController <-> AI Pawn dependency be like

Hi, I’m a beginner with UE4 and I don’t know how to handle Controllers.
In my simple game I omitted PlayerControllers by handling everything in my only Player class, but now I need to create enemies. My idea was to create an AIController function with really basic logic that would then interact with its possessed Pawns. To set an example, let’s say my AIController has a function named Shoot(). It is called every once in a while, based on a timer, and all it does is call the respective Shoot() function in its possessed Pawn, which in turn has a more specific logic. And that is where the Controllers role ends. My question is, is it the right way to set this up, or is there a better, preffered way to do it?

And by the way, I’d like to know how can I cast an AActor* returned for example by GetControlledPawn() to its actual class. Let’s say AIController is controlling an AMyEnemyType instance. How do I GetControlledPawn() as AMyEnemyType* instead of AActor* ?

You should use GetPawn GetControlledPawn instead. GetControlledPawn was deprecated.

Cast<AMyEnemyType>

takes desired type of the pawn. If you do not use behavior trees then in fact not matter who owns the function Shoot.

Thanks, the Cast was exactly what I was looking for!

For the future: how is the preffered Controller <=> Pawn relation, what should the Controller be responsible of and what should Pawn be responsible of?

Controller is a manager of the pawn’s actions, active behavior tree, senses and path following. Controler should response to reactions (commands) from any of his components such as new action, user input, AI command etc. Pawn (character) is an entity which follows to controller’s commands (move, shoot etc.) .