For my game each unit will have one camera a external ‘Unit cam’ to allow free view around the unit within a certain range. Simple. Spring arm and camera.
My players unit however will have multiple cameras, one unit camera like the rest but also cameras with clamped pitch and can move up and down vertically a certain distance as well as zoom in/out.
Originally I was creating a standard UnitCam in my base pawn class so that each one had it, and then my players unit class had the additional cameras; needly to say having to get all cameras and deactivate all of them then activate the one needed, especially when the number of units (and thus unit cameras) can be ever changing from 1(just the player) to dozens if in a heavy battle.
So I finally decided to play around with the PlayerCamagerManager class, as it seems to allow me to remove all the camera logic from the pawn classes or player controller and keep it nice and tidy in a seperate class.
What would be the best practices for a setup like this? I originally thought I would just add a spring arm and attached camera to the PlayerCameraManager but now I realize it spawns a camera in by default on the currently possesed pawn with no way to enable/disable it, or even translate it through the blueprint.
I will delve into the C++ as I’m watching the twich stream “flexible camera control through C++” and maybe get rid of the defalt camera spawning logic so I can blueprint my own setup.
Am I going in the right direction?
TLDR: How best to use the camera controller class Blueprints & C++ for a non-first person shooter game (vehicle combat simuator) where the player has multiple cameras and each unit has a camera, but only one can be active at a time, to keep things clean and future proof.
Edit: I should add that I noticed even trying to add an offset or rotation to the default TransformComponent scene component inherited from c++ in the PCM bp, does nothing since the PCM seems to stay the player spawn point. Maybe I’m stuck with having to do camera control through the player controller and indivudally activate one camera and deactivate the rest through many careful loops?
Whats most confusing is even ticking SetActorLocation(0,0,0) keeps the actor set to where the currently active pawn is, how is this behavior defined?
What makes sense to me, but seems less future proof and harder to modify is to have each pawn create a camera/spring arm setup on Possess and destroy them on UnPossess and the player would then destroy all camera and spring arm components and create the camera/springarm setup needed through a custom event when switching to one of the 2/3 other camera views the player has. That allows unit switching but means all the logic is stuck in parent classes.
Edit2: Would Blueprint_UpdateCamera be more to my needs? Set the default unitcamera positon and spring arm setup in there, and if activePawn == GetPlayerPawn and bUsingPlayercamera2 == true then do a branch for the players camera implementation on a seperate return node?