PSA: Control player starting transform

So I spent the better part of a day and a half tearing my hair out trying to solve this problem. Now that I have it working somewhat reliably, I would like to share the pitfalls I ran into.

My goal was to set the player loc and rot to a specific place once the game start. My game has two players sitting in a chair so I decided to use an extra scene component on my chair actor to decide where the player sits / looks at. Trying to set the position at the beginning was trivial, however setting the rotation was a bit more difficult to figure out.

When replicating you must set the player position on the server. When setting the player rotation this must be done through the Player Controller, however, the server’s client Player Controller (PC01) DOESN’T control any pawn’s. Therefore, since Player Controllers are only local to a players machine and not shared with other players, you must rotate on client and NOT on the server. This was my first issue with this, there is another problem that took me most the day to fix and I still don’t completely understand why.

Above is my current solution to finding an open seat and then setting our players seat transform variable. Initially I was using the random node to pull a random item from the Out Actors array of my Get All Actors Of Class, but I was having issues with the players sitting in the same seat. I starting trying to use the Random Integer In Range after spending hours not being able to get the Random node to work. It wasn’t until later that I realized when you string the output of a random node or a random integer in range to multiple locations it will roll each time. That’s why you must set it to a variable as soon as you roll and only use that variable. However I still have issues with the random node, even now, I still have occurrences where the client will randomly spawn in the same loc/rot as the host. Below is how I tried this setup after thinking and writing this out, but it still sometimes teleports the client to the host’s loc/rot.

Any thought’s on why this isn’t working would help soothe my brain, otherwise, hope this helped someone.

Edit: Updated first two pictures to make it flow better by setting SittingTransform after getting our transform. Didn’t update 3rd pic because you can see what changes have been made to main process.

Edit 2: Just found out that the same method applies to setting the clients camera transform. You can’t do this through the server, your flow needs to check if the character is an owning player instead of looking for authority. Clients have to change their own loc and rot for the camera and rot for their character actor.

The character class uses the Character Movement Component (CMC). It is client-side prediction based. Movement (location/rotation) has to be applied to the client, then server.

To apply a server determined rotation to a client you create an Event in the controller that “Runs on Owning Client”. Pass the rotation.

Control Rotation and Base Aim Rotation are passed up internally via RPC’s. There’s no need for you to manually send these values to the server.

I’m using this to handle random rotation on Spawn. Event is called from the game mode.


As far as your other issues go you should be assigning seats (spawn location, rotation) in the GM prior to spawning the characters. This should not be determined by the character class.

The GM can get a reference to All Seats, and then assign them as players join. GM would pick a seat, set location, rotation, spawn character, set the characters spawning state (sitting etc), Set control rotation on the camera (RPC owning client controller) and then possess.

Ahhh okay, that just helped simplify everything, thank you. I was having a hard time jumping through hoops trying to figure out how to set that up through the character itself. Putting that logic in the gamemode makes much more sense, I’ve seen this in other projects so I don’t know why it skipped my mind this time.

So, on Event OnPostLogin we store the player controller into an array and then handle any positioning logic here in the game mode. I really appreciate the in depth response, it helped to make things click. It’s difficult understanding what needs to go where sometimes, I think its about time I crack open all the docs and review everything.