I have made a teleporter and when a player runs through it I want the player to rotate so that he’s facing away from the teleporter he teleported to, no matter if he went face first, sideways or backwards into the first teleporter.
I understand it’s something with the player controller holding the rotation information, but I can’t seem to get it right.
The player’s rotation will be the SpawnLocation.yaw if you do it like this. So rotate the SpawnLocation such that the forward vector (red one) is pointing in the desired facing. The player will then always look in that direction when spawned there.
If you want to do this in multiplayer, then you would want to let the teleporter send a request to the server to change the rotation. So if someone walks through the teleporter, you call your “teleport” function i guess.
I would make a custom event called “teleport” which is replicated to server. Give it a reference to the PlayerController or Character who activated the teleporter and let the Server set the rotation.
The server has ALL player controllers. he can work with a player controller that you give to him. The Player itself only has his own (0). So with this PlayerController that you gave the server to work with, you can now set the Actor Rotation of the Character and maybe the controll rotation of the Controller itself to a new rotation. The new rotation should be made like you tried in you last comment picture.