Calculate location based on pitch

Discussion in 'Plugin Development' started by Ciaranlol, Sep 21, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Ciaranlol

    Hi there,

    I'm kinda new to vectors but I'm really strugling with them. What I want to make is that I can teleport a player to another player, but not really on the same location is that player but to the side of them. So that they will stand next to each other and not inside each other. Can someone explain to me how I can achieve this?
     
  2. Offline

    Tecno_Wizard

    Ciaranlol, I would just change the teleport location a block more x or something to that effect.
     
  3. Offline

    IkBenHarm

  4. Offline

    Ciaranlol

    The thing is that I really want the player to spawn next to the other (side by side) so they are looking the same direction.
     
  5. Offline

    Tecno_Wizard

    Ciaranlol, okay, give me one min to look at the player API.

    Ciaranlol, I would do this. first, determine which cardinal direction 0 degrees yaw is (this can be done with the debug mode, F3 i believe). Once you have determined that, check to see if you can move the player to the side in either direction. If you can, add/remove an x/z and teleport using the player's yaw and a pitch of 0. Otherwise, teleport then as normal, right on top.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
    Ciaranlol likes this.
Thread Status:
Not open for further replies.

Share This Page