Download

Is this a way to implement this type of camera or is there a better way ?

So, from my limited experience with UE4 it seems to me that the main input is always directed via playercontroller right ? So technically whatever responds to the input must be a player ? That works great for a lot of scenarios but in my case I have a top down camera that , unlike top-down demo, does not follow the player.Instead - camera control and player control are 2 separate things. The player is moved around by clicking on the ground and camera is moved indepenedntly with mouse and keys. . I got that to work by basically doing the following:

  1. Created a pawn that has springarm and camera and exposes public functions like Rotate and Move which accept appropriate parameters
  2. Created a custom player controller that basically serves dual purpose. If it captures mouseclicks or other player-specific input then it just does whatever it needs to do. But if it captures camera based input it forwards it to the public functions of the pawn set in 1. That moves / rotates the pawn and its’ attached camera.
  3. At the beginning of the game I grab player’s controller and set its view target to the pawn from 1.

And all that works fine.

Just wondering if there’s a more streamlined, “proper” way to do this, since it’s a fairly common scenario.

I did see something called SpecatorPawn but not sure if that’s what I need. Did some searching but mostly got results about how to set specator’s camera, etc, without understanding what a spectator really is ? Is the way to implement above via this spectator or is what I have OK as is ?

You talking about a more RTS style setup?

ie. manually controlled camera that does not follow specific actor.

Yup - pretty much. Camera moves with WASD or whatever, but the actor moves only when you click somewhere.

So right now I had that implemented as in my post above - a custom player controller, that based on the input either controls “camerapawn” that has camera attached to it OR the player itself. And that works the way it is, but just wanted to see if that seems like the right way or if there’s some different, more standardized way to do it.

No, that is pretty much all there is to it then.

Are you using the built in implementation for capturing input (via the Input Component & Enable/Disable Input) or have you rolled you’re own?

Yeah, just through project/settings and setting those axis mappings and what not. That’s how I have the actions set up. That’s what you’re asking right ?

Yeah, they’re the ones.
Combined with Enable/Disable Input, you can reroute them to any actor you like.