Download

Camera Controls - Who decides where the players camera is positioned?

Hey everybody,
I’m at a point now where my pawn class gets kinda messy because of me thinking “let’s get it working, we can make it pretty later on” way too often. I think that ‘later’ I referred to back then is now: It’s refactoring time.
I already ripped some things out and the code gets better organized but I have no idea where I should put the code for my camera controls.

Let me explain:
Most of the time is spent in a vehicle where the camera cannot be controlled by the player besides looking back. This is currently all I have implemented and as stated above: It’s in the pawn class.
Later in the development process it’s planned to have some occasional cinematic or tracking shots for level introductions or cutscenes and maybe a bit more camera control during gameplay.

So while refactoring the code I wondered how this is done generally. Which class controls which camera is active and where do I put the code to control the camera if needed (in this case looking back while driving a vehicle).
I already found the PlayerCameraManager which according to its name seems like it could solve my problems but I have admittedly no idea how I would implement it. Browsing the Engine code didn’t help with that.

Are there any materials which explains these things or could someone please explain how I should refactor my current setup? I don’t just want to “get it working” in another file, I want to solve it for good with the option to extend it later.

Best regards
twinflyer

Am I doing something wrong or does everyone get an error if a new thread with tags is submitted?

I would put code for pawn specific camera actions in each respective pawn class. For cut scenes, use matinee or sequencer. The PlayerCameraManager is responsible for blending between cameras and generally doesn’t need to be extended.
https://docs.unrealengine.com/latest/INT/Gameplay/Framework/Camera/