Is it possible to use both PlayerController and AIController with the same Pawn?

In my top-down game (made from top-down C++ template) with pawn’s movement controlled by mouse clicking, I want to use MoveToLocation method of AAIController but I can’t since I use a controller derived from APlayerController which doesn’t have such functionality. Is there a way for me to use this moving functionality with my player pawn or achieve same result with something else?

I tried using AIController for my pawn and using Player Controller in spectator mode but then it does not get attached to the camera.

i dont know about C++ but in blueprint its not all that hard to do something similar. below is a little test script i made which if im getting you right is what your trying to accomplish. this is done in the player controller and the idea is to move a character via mouse clicks without possessing it. basically i get the hit result under cursor and if its a character i set the variable character to control then i set the view target which makes player controller use the characters camera. if i click with the mouse and its not a character then it moves the currently selected character to where i clicked.

obviously this is incomplete lacking is valid checks and such but its a proof of concept. im sure you could use something similar in C++.

Huh, I didn’t know about SetViewTarget method. I will do more testing but seems like this is it, thank you very much.

yup it allows you to switch cameras and if you add in a blend time it will move the view by blending which is nice. course you could probably just have a camera pawn that you posses and move that to center on whichever actor you select.