Separate player and camera controls

Hi,

So this has been a hard one for me the past couple of days, and I can’t seem to find a solid answer to it by just googling. But my goal is to control the player with WASD, and the top down camera with the arrow controls and moving the mouse cursor to the screen edges (RTS style). My biggest issue is not so much the individual nodes (hopefully I can figure that out myself), but more on how to set it up, and what blueprints to use so they communicate in a proper way?
Like should the camera be a player/pawn of its own or part of the character? Should the character be a player or a pawn? Maybe AI? Should any of it be set up in the game mode BP, level BP, controller BP? etc etc. In my own attempts I seem to only be able to control one or the other, but never both of them at the same time…

I am still new to unreal, and what to put where is a bit confusing. I’ve found a couple of quickly described theories on ways that might be able to work, but no response to if any of it actually works :confused: So now I’m posting here hoping some helpful soul who knows how to set it up could shed some light on it.

Thanks in advance!

I would keep the camera separate from the pawn if I were you, but it can be controlled by the same player controller as possesses the pawn. Just make sure nothing among the three has Use Control rotation checked.

I think all of this can be part of one class, but to control camera separately you would use player camera manager, with
overriden BlueprintUpdateCamera function. it allows you to override camera transform in world space, so you can put any desired movement logic in it.

To be clear - create your PlayerCameraManager class from engine one, set it as PCM in your PlayerController, and override BlueprintUpdateCamera funtion in it. There you will find boolean output named UpdateCamera that must be checked. Them put camera movement code in. Player pawn must.have camera component inside itself to make PCM find it and use.

Hi, thank you for your quick reply :slight_smile:
But when you say to keep the camera seperate from the pawn, do you mean seperate from the player pawn or the camera pawn (i.e not using one for the camera)?

Thank you, I will get back to you after I’ve played around with it! If I get it to work I will mark your answer as correct, otherwise I might need some further assistance (hehe). But thanks again for your quick reply!

I guess i mean camera has its own Pawn. But I saw the other answer about making your own camera Manager and that sounds like it could be better.

I hope reviving an old thread like this isn’t frowned upon, but I’m looking for help with this using UE5. I’m still fairly new to using the engine so you will have to excuse my lack of knowledge/understanding.

I’m following your advice on doing this very same thing of separating the camera and possessed pawn/character, but the part that I’m a little hung up on is how to control this camera that is now being controlled/managed by the newly created player camera manager.

If you don’t mind taking the time to explain, how would I get PlayerController (where I’m handling input from kb/m) to tell PlayerCameraManager to move the camera upon player input?

  • Would I have to implement the enhanced input event reading/coding in PlayerCameraManager’s event graph?
  • Are there specific functions or calls one can make from PlayerController to PlayerCameraManager?
  • Or am I completely off-base in understanding how to do this/how it works?