Basic spectating system not working as intended on Client?

Hi. I’m trying to make a basic spectator system where a player dies, he/she can spectate other alive players. The logic behind it is very simple however I’m facing a weird rotation issue when the client tries to spectate.

Basically, all I’m doing is adding each player to a Players array in my GameState on BeginPlay. When someone dies, they can spectate through the alive players using this simple code:

The problem is, if the server is the one spectating, the rotation of the camera works as intended, however if a client is trying to spectate, then the camera won’t rotate.

Server spectating client (how I want them both to behave):

Client spectating server (rotation not reflected):

Any ideas how I can make this work? I know that Set View Target with Blend is a hacky way of doing things like this but I’m trying to learn/keep it simple with this project. Any tips/help appreciated!

1 Like

I’m away from UE atm, but in the client character, have you turned off “UseControllerRotationYaw”?

1 Like

Yeah it is turned off. Here are the movement/camera settings I’m using. And the server+client have the same character.

image

1 Like

Any ideas? I really want to get this to work properly!

1 Like

Did you try turning off “Use Pawn Control Rotation”?

2 Likes

Yeah I did, and that works but since I’m using ALS it messes up a lot of the movement so that solution is out of the box for me. =(

Edit: I am trying to add a new springarm + camera as the spectator camera so I can switch to that when the target is dead but I cannot seem to make it work.

Edit2: OK I managed to switch cameras however it is now super jittery. Not sure what it’s about nor what I could do to fix it… Any tips?

Edit3: Seems like if I disable Use Pawn Control Rotation the jittering happens. However if I enable it, the rotation does not work as intended. :sweat_smile:

Final edit - FIXED: It was Camera Lag causing the jittering. x) I had it enabled on one camera and not on the other. Enabling on both seems to fix the issue. Yay.

2 Likes