Make exactly 2 players always face each other in 3D

Player Indexes are only counted on the machine that their connection comes from. That’s why this works for the 2nd player if theyre on the same machine.

Quick fix: Get all Pawns, remember the first two that have a valid PlayerState, and execute your same code on those two. That might fix it. there are a few other ways to do it that might work better but i think that one will work well enough.

I just started a 3d fighting game. I’ve got two players, each with a thirdperson camera behind them. I want the two players to always face each other, so I wired up the following:

On a client-hosted server, both players face each other. However if you’re a client, you don’t face your opponent, you face the origin. This is probably related to the error that I’m getting:

Blueprint Runtime Error: Accessed None trying to read property CallFunc_GetPlayerPawn_ReturnValue1 from function: 'ExecuteUbergraph_ThirdPersonCharacter' from node: SetActorRotation in graph: EventGraph in object: ThirdPersonCharacter with description: Accessed None trying to read property CallFunc_GetPlayerPawn_ReturnValue1

But I’m not sure how to fix it. I suppose if I’m Player 0 I’m not allowed to just get Player 1’s Pawn? But I don’t know how else to implement the behavior.

Once this is fixed, I want to figure out how to make player movement relative to the other player instead of relative to the world, and how to get the camera to move relative to the player instead of always facing X+

How do I get all pawns instead of just one? I’m still trying to get UnrealEd set up with VSCode+compiler so I haven’t done any cpp yet

GetAllActorsOfClass is a BP Node for you.

I’d also make sure that you get your replication calls right, sounds like that is all you need to fix.