Controlling Character & Camera Separately

Anyone have any suggestions for setting up completely separate controls for the user’s character and camera?

In my game, there’s a character the user is moving around the scene, but the camera doesn’t follow it at all. The camera is manually controlled by the user separately from the character’s movements. Because of this, I can’t just put my camera component in the character blueprint/code as you normally would.

There are a couple things I’m considering trying:

  1. Since it’s almost like there are two “players” in the scene, set up two separate pawns – one with the character mesh, one for the camera with no geometry – with the different controls. This would possibly be helpful if the character class already has code built-in meant for taking user input and translating it into movement.

  2. Just have one pawn, which is just the character geometry and has no camera component. Spawn a new unattached camera on event begin play, and dynamically bind camera controls to it at that time (the code for all this probably living in the player controller).

Anyone have any advice? Maybe there are other options I haven’t thought of? I’m relatively new to UE4 and I’ve found the camera documentation to not be as clear as some of the other sections :confused: Thanks!

Hey,

I think your idea of basically creating 2 players would be the best. Each with a different set of controls :slight_smile: I mostly suggest doing it this way since I previously tried to do something similar to your second option, however I was not able to possess the camera and at the same time still be able to control the player. In the end I had to resort to using a matinee camera instead, which worked, however I think in your case this would mean that you wouldn’t be able to control the camera. It would probably easier to just create 2 players for what you are trying to achieve.

I did end up creating two pawns, one for the camera and one for the geometry, as well as a single PlayerController that sort of communicates between the two of them and stores general player information that’s not specific to the camera or geometry. Working pretty well so far.