How do I set the rotation of a pawn in multiplayer? If I set the pawn actor’s rotation, nothing happens. (Actually, it gets set by my blueprint but then somehow it gets immediately reset to its prior rotation.) If I get the pawn’s player controller and set the player controller’s rotation, it works on the server but not on the client. In addition, not only does it not work on the client, but the rotation of the server’s pawn gets changed to the what the client’s rotation was supposed to be. Why is this so hard? I’m also setting the pawn’s location (using set actor location) and it works perfectly. Why would rotation not work identically?? Really frustrating.
You should call a custom event on the client to set the controller rotation.
I don’t understand. Can you explain more? And why would I need to do that for rotation but not for location?
Well if your character’s rotation is based on the controller rotation then you can’t use set actor rotation because it will simply reset to the controller rotation right away.
So you need to set the controller rotation instead, which as you said it only works on the server so I’m assuming you could make a custom event that replicates from the server to the client.
But it all depends on what you are actually trying to do… you should probably explain a bit your current character setup and your goal.
Thanks. I started with the shooter game example and I’m trying to add portals that work in multiplayer. My overlap handling for the portals in blueprint basically says if it overlaps a player then teleport that player (which could be the host player or any of the client players). How would I know if it’s the host or a client? And which client player? Sorry I’m new to ue4.
Okay, so basically you want to set the player rotation when he teleports?
I would recommend that you go through Epic’s networking tutorials if you don’t know how to go about making replicated events.
Basically you can use the “Switch Has Authority” macro node to separate host from client but it’s not always that simple.