1. So I am busy with a plugin that will teleport players to each other to a random spawn point, this is for a Duel plugin.

    My issue now is after teleporting the players they are facing random directions, I would like to rotate the players to face each other. Does anyone have any idea to do this?
     
  2. Have a look at NetworkEventRespawn.Execute(), this sets the player rotation.
     
  3. Thank you very much for your reply. I will have a look
    [DOUBLEPOST=1456245274,1456209157][/DOUBLEPOST]Okay this is what I have tried, but doesn't seem to be working. I am clearly missing something

    playerEntity1.transform.position = Vector1;
    playerEntity2.transform.position = Vector2;

    playerEntity1.transform.LookAt(Vector2);
    playerEntity2.transform.LookAt(Vector1);
     
  4. Not sure if works, but you can try and tell me the results :)

    You get each player sessions and find both FPSInputControllerServer from the players:
    Code:
    FPSInputControllerServer fps1 = player1Session.WorldPlayerEntity.GetComponent<FPSInputControllerServer>();
    FPSInputControllerServer fps2 = player2Session.WorldPlayerEntity.GetComponent<FPSInputControllerServer>();
    You find both vectors that point from player1 to player2 and player2 to player1:
    Code:
    Vector3 vector1 = (player2Pos - player1Pos).normalized;
    Vector3 vector2 = (player1Pos - player2Pos).normalized;
    Then get both Quaternions that create the rotation:
    Code:
    Quaternion lookRotation1 = Quaternion.LookRotation(vector1);
    Quaternion lookRotation2 = Quaternion.LookRotation(vector2);
    Finally you use the ResetViewAngleServer() from both FPSInputControllerServer:
    Code:
    fps1.ResetViewAngleServer(lookRotation1);
    fps2.ResetViewAngleServer(lookRotation2);
    Check that out.
     
  5. Your code worked out the box,, thank you very much!