Where is the initial Location of PlayerCameraManager set?

EDIT:

I think the solution to my problem would be to know where the initial Location of the PlayerCameraManager is set. My own CameraManager is set in my own GameMode class. The PlayerNetworkStart spawns my pawn with the CameraManager. I can’t find any method that sets the Location for this Manager, not in the constructor nor in the PlayerController or in the GameMode. Does really no one have a clue?

I would like to understand how the Camera works in the ShooterExample in order to add a 3rd person view.

I already figured out where the work is done.

PlayerCameraManager.cpp:


MyPawn->OnCameraUpdate(GetCameraLocation(), GetCameraRotation());

So, the CameraManager calls this function:


void APlayerCharacter::OnCameraUpdate(const FVector& CameraLocation, const FRotator& CameraRotation)
{
    USkeletalMeshComponent* DefMesh1P = Cast<USkeletalMeshComponent>(GetClass()->GetDefaultSubobjectByName(TEXT("PawnMesh1P")));

    const FRotator RelativeRotation = bViewFlag ? DefMesh1P->RelativeRotation : GetMesh()->RelativeRotation;
    const FVector RelativeLocation = bViewFlag ? DefMesh1P->RelativeLocation : GetMesh()->RelativeLocation;
    const FMatrix DefMeshLS = FRotationTranslationMatrix(RelativeRotation, RelativeLocation);
    const FMatrix LocalToWorld = ActorToWorld().ToMatrixWithScale();

    // Mesh rotating code expect uniform scale in LocalToWorld matrix

    const FRotator RotCameraPitch(CameraRotation.Pitch, 0.0f, 0.0f);
    const FRotator RotCameraYaw(0.0f, CameraRotation.Yaw, 0.0f);

    const FMatrix LeveledCameraLS = FRotationTranslationMatrix(RotCameraYaw, CameraLocation) * LocalToWorld.Inverse();
    const FMatrix PitchedCameraLS = FRotationMatrix(RotCameraPitch) * LeveledCameraLS;
    const FMatrix MeshRelativeToCamera = DefMeshLS * LeveledCameraLS.Inverse();
    const FMatrix PitchedMesh = MeshRelativeToCamera * PitchedCameraLS;

    Mesh1P->SetRelativeLocationAndRotation(PitchedMesh.GetOrigin(), PitchedMesh.Rotator());
}

As far as I understand, the mesh is set relatively to the camera. Therefore, if I want to add a 3rd person perspective when bViewFlag is false, I need to set the mesh (which is going to be a character) further away compared to the FirstPersonMesh (Mesh1P). But I don’t know where to set these values. Additionally, I don’t really understand matrices, since I am just right at the beginning of my Computer Science studies (already tried to read the code, but it didn’t help).

Does anybody have a clue why the camera is handled like this and not with a camera + spring arm?

I tried to set the values at different points like “CamerLocation” and “RelativeLocation” but nothing worked well. I want to stay with c++ since I need to have many different camera views (like inside of a vehicle, 1st person, 3rd person, etc.).

Thanks in advance!