Camera defaults to origin when the player pawn is destroyed

There are a couple of existing questions that touch on this topic so far (This, this and this), but none of them offer a solution for the issue that I’m seeing.

I have two different cameras in my game, one of which exists on the player pawn, and one of which is an external camera in the GameMode blueprint; both of these cameras are active at any point, and I simply switch the view target between the player pawn and the GameMode. The GameMode camera is attached to a camera arm, and while it is active I rotate it around a central point every tick. Switching view targets this way works fine. However, when I destroy the player pawn, the external GameMode camera stops displaying what I expect it to, and instead defaults to the origin. I’m not really sure why the lack of a player pawn should affect a camera that isn’t connected to it in any way.

One thing I’m going to try, which will probably take a while, is to move the external camera from the GameMode to the CameraManager, as it sort of makes more sense for it to be here, and this class isn’t doing anything anyway. I’m not really sure why this would make a difference, though.

So you’re right that the camera on the game mode shouldn’t care that the player pawn is gone. One reason I can imagine it resetting to 0,0,0 or player start would be because somehow the camera target is set to point to the pawn at all time, and a resetting pawn recenters the camera.

One other thing that’s possibly happening is the actual respawning of your pawn would use a different pawn than the one you think, the spectator pawn of sorts (default engine pawn), and that would set the camera to player start or 0,0,0. (I think this may be the case).

Could you maybe share the blueprint of that gamemode camera, if any stuff is in there camera related, how you hook the camera to the viewport and what the viewport tab of your player pawn does. Also share your game mode settings under Projects / Maps and mode / Game mode. Your pawn should be set there otherwise respawning spawns will be default pawns of the engine, causing that camera to switch to them.

Hope this helps :slight_smile:

One other thing that’s possibly happening is the actual respawning of your pawn would use a different pawn than the one you think, the spectator pawn of sorts (default engine pawn), and that would set the camera to player start or 0,0,0. (I think this may be the case).

This was exactly the issue; the way my code was set up, the PlayerPawn was calling the function that switched to the exterior camera, and then destroying itself (Without spawning a new pawn). When the player pawn was destroyed, Unreal clearly switched to a default pawn, which was overriding the View Target from the GameMode, so my external camera was behaving correctly, it just wasn’t the active camera any more. Pretty obvious in the end, but still quite a weird quirk of Unreal.

Thanks so much for your help!