I want a spectator mode in my networked 3rd person shooter project that allows a dead player to cycle through the other living players and see what they see so they can still watch the action. Players can be revived by other players, so they must stay as their dead and immobile character, except with the new ability to jump their view around between other player’s cameras while they wait to be revived.
What I’ve tried:
I have a script up that cycles through every other player on a button press (my player class is called HitCharacter_BP, so when you see that in GetAllActorsOfClass that’s what that’s getting. HitCharacter_BP inherits from Character.). It sets the view target of self to be a different character each time the button is pressed.
What happens when the button is pressed is halfway to what I want. It does snap the camera of “self” to the other player’s root position, so while that other player moves around my view translates with their movement. The rotation however never changes from <0, 0, 0>. Additionally, I want it to set my view to look through (or from the perspective of) the other player’s camera, not the other player’s root. Something to note here is that when my own character is set to the view target in this way (which happens naturally as I cycle through all characters) I do in fact see though the camera on my character and not just through the root. This is the behavior I want to happen on every other character too.
I have also tried many variations of what to pass into the “New View Target” node of “Set View Target with Blend”, all with either the same results or no results (meaning the view target gets set to null, so I just look through the root of my character instead).
A character’s component hierarchy is like this:
The root has a springarm child called CameraBoom, which has my camera child called FollowCamera. Both CameraBoom and FollowCamera are in the “Camera” category, if that matters.
In my mind the fact that I set “Find Camera Component when View Target” to true on the other characters should mean that I will see though their camera, but that only ever works when it get’s set back to the character that happens to be me.
Anyone know what I’m doing wrong, or if my goal is even possible in this manner?