Can someone explain character rotation

Hi guys,

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.

My graph is like this:

It seems pretty random (which ofc. it’s not) what the player rotation is, when he “spawns” at the new location.

Do I have to add or substract some numbers to get rotation right or???

This answer addresses the same question, but I cannot get it to work replicate the result.

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.

Have you tried simply like this ? :

But that is only player at index 0. That won’t work in multiplayer, if I’m not mistaken.

I’m not entirely sure how you’d structure that. Is it something like this:


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.

Thank you for the explanation. I’ll try to achieve that tomorrow. Going through the replication tutorials and finish them tomorrow as well. I’ll let you know how it goes.

I reckon I have to change the setup slightly to make it work proporly in multiplayer (in addition to handle rotation).

Ohh yeah… Times flies when spending 24/7 inside the engine. I haven’t actually prioritised getting the rotation to work yet. So many things to learn.

Thank you for your time eXi. I apologise for not trying out your solution and getting back to you in time.

(: No problem, take your time.