Change CameraManager from ACharacter

Hi!

I’m trying to setup camera switch for Player Character in code.
Faced with problem that I need to switch PlayerCameraManagerClass inside PlayerController. I’ve implement a function for that :



void ACustomPlayerController::SwitchCameraMode()
{
FPCameraOn = !FPCameraOn;
PlayerCameraManagerClass = FPCameraOn ? ATPCameraManager::StaticClass() : AFPCameraManager::StaticClass();
}


But I can’t figure out how can I call it from ACharacter class, or GameMode, or directly with detected KeyPress \ or Event from ACharacter. Any of these solutions would be acceptable. I’ve already tried to call it from Character, but hadn’t found any references.

Already found a way to call custom player controllers functions from custom player character code.


ACustomPlayerController* const PC = CastChecked<ACustomPlayerController>(Controller);
PC->SwitchCameraMode();

But when I’ve set up default ViewLimitation inside of constructor for camera mode inside game I can see that they are in World coordinates. So it means for example if I will setup


ViewYawMax = 0.f;
ViewYawMin = 180.f;;
ViewPitchMin = -90;
ViewPitchMax = 90;
ViewRollMin = -90;
ViewRollMax = -90;

and switch camera in game - Yaw View angle will be difirent from the point where I switch it in world-space.
So sems that something wasn’t done correctly, please help.