# Shared Camera breaks if one player dies

**URL:** <https://forums.unrealengine.com/t/shared-camera-breaks-if-one-player-dies/418522>\
**Category:** Cinematics & Media\
**Tags:** unreal-engine, local, Multiplayer, Blueprint, question\
**Created:** [February 27, 2018, 11:50pm UTC](https://forums.unrealengine.com/t/shared-camera-breaks-if-one-player-dies/418522 "2018-02-27T23:50:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![llPengPengll](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@llPengPengll](https://forums.unrealengine.com/u/llPengPengll)\
**Post date:** [February 27, 2018, 11:50pm UTC](https://forums.unrealengine.com/t/shared-camera-breaks-if-one-player-dies/418522/1 "2018-02-27T23:50:40Z")

</div>

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

 ![232236-eventgraph.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/3/6/7365fa833b4d885862e153f10f6be9e8e63ebe10.png)

Class Setup Function :

 ![232237-classsetup.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/f/5/0f5006b8c3c249b9d6e3b8ecdafc6616719bd1c8.png)

Set Arm Length Function:

 ![232238-setarmlength.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/3/2/632ae6613b838662ecc1ef800f8e4690e7f6ac19.png)

Set Camera Pos Function:

 ![232239-setcamerapos.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/7/6/876d05cbb73330cb69609363c694424c9d0fba50.png)

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

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_49a519741](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_49a519741](https://forums.unrealengine.com/u/anonymous_user_49a519741)\
**Post date:** [February 28, 2018, 1:26am UTC](https://forums.unrealengine.com/t/shared-camera-breaks-if-one-player-dies/418522/2 "2018-02-28T01:26:25Z")

</div>

Are you destroying the actor when the player dies?

---

<div class="post-metadata">

**Author:** ![redbox](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@redbox](https://forums.unrealengine.com/u/redbox)\
**Post date:** [February 28, 2018, 5:03am UTC](https://forums.unrealengine.com/t/shared-camera-breaks-if-one-player-dies/418522/3 "2018-02-28T05:03:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Darrel\_Leigh](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Darrel\_Leigh](https://forums.unrealengine.com/u/Darrel_Leigh)\
**Post date:** [April 9, 2018, 2:50pm UTC](https://forums.unrealengine.com/t/shared-camera-breaks-if-one-player-dies/418522/4 "2018-04-09T14:50:32Z")

</div>

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