Shared Camera breaks if one player dies

Hi everyone,

I followed a tutorial where a shared Camera for a local Multiplayer was created. Everything works actually fine (Zooms out when players go away from each other and so on)
Only problem is, when a player dies, the camera acts wierd:

If first Player dies, the camera completeley breaks and if the second player dies, the camera zooms at the first Player.

Here are my BPs :

Event Graph

Class Setup Function :

Set Arm Length Function:

Set Camera Pos Function:

The GetLocation Pure Function is actually like the normal get location only with an “IsValid” node and the CalculateDist Pure Function is a normal get Distance to Function with an isValid Node.

I hope you can help me,

Sincerely,
Mike

Are you destroying the actor when the player dies?

You work with 4 hardcoded players refs, so if one of them dies/destroyed, everything will be broken. You should process array of available players, with for() or foreach(), so you always get actual data.

In this case, in Class Setup Function you don’t need to reference every player. In Set Arm Length Function you have to come up how to process all distances combinations. And in Set Camera Pos Function - get players locations from array in foreach() and summarize them.

I’m having the same problem, have you found a fix?