Need some help handling and resetting camera positions better.

Hello! So I have 3 setups for my player camera, 1st person that’s attached to a socket on the skeleton, 3rd person that’s attached to a spring arm, and an orbit/overview camera that’s attached to the springarm, but moved further away and at a more birds-eye angle. The player can move between these 3 positions at will, but currently the transitions are a bit jarring (the directions the camera look in after switching “feel” random, even though they technically arent) and I would like to translate them in ways that make them feel more relative upon transition, but I am not quite sure of how to handle them the best way.

Currently, the transition between the 3rd person and orbit cam is fine as it’s just an interpolation of distance. But I need to override the rotation of the camera/springarm when in orbit mode, currently if the player enters orbit mode while looking up, the camera will still be angled up, instead of looking down from a birds eye view.

Here’s an example of how I set the position and distance of the camera when entering orbit mode:


if (!bOrbitCam)
{
  SavedCamPosition = PlayerCameraComponent->GetRelativeTransform();
  SavedZoomFactor = ZoomFactor;
   PlayerCameraComponent->SetRelativeTransform(FTransform(FRotator(0.f, 0.f, 0.f), FVector(0.0f, 0.0f, 0.0f), FVector(1.0f, 1.0f, 1.0f)));
   PlayerCameraComponent->AttachToComponent(CameraSpringArm, FAttachmentTransformRules::KeepRelativeTransform, UTribesmenSpringArm::SocketName);
   AnimInstanceRef->FirstPerson = true; //disables headtracking for orbitcam
   bOrbitCam = true;
   ZoomFactor = 600;
}

Zoomfactor is the value I interpolate between to determine camera distance while attached to the springarm.

I guess I should be setting the spring arm rotation instead of the camera transform?

Also, when going from the 3rd person/orbit cam to 1st person, I wish to keep the same viewpoint so that the player isn’t suddenly looking into the ground, at a wall or at the sky when changing perspective. But I’m going spring arm to camera attached directly to a socket, and I’m not sure how I would translate the math for them to be equivalent?

I must admit that I’m probably also very confused with how the rotation of the controller is also involved in all this.