How can I teleport a player to a location relative to another player?

How can I teleport a player to a location relative to another player? - Free stock photo of action, adult, athlete

I want to teleport a player to a location relative to another. For example, I might want to teleport Steve so that he's exactly 50 blocks on top of Joe.

I can't use /tp, since that will teleport Steve directly onto Joe's location. Is there a way I can teleport someone to somebody else's location, but with an offset? I'd like to do this with a single command, if possible.



Best Answer

The /tp command accepts relative arguments (~), but you won't be able to do it in a single command. You may wish to use a pair of command blocks to execute them quickly and more or less seamlessly.

The following will teleport Steve to Joe, then zero blocks forward (in the x direction), fifty blocks up (in the y direction), and zero blocks to the side (in the z direction).

/tp Steve Joe
/tp Steve ~ ~50 ~

The format is as follows:

 /tp [player] <x> <y> <z> [<y-rot> <x-rot>]

More information can be found on the Official Minecraft wiki: http://minecraft.gamepedia.com/Commands#teleport




Pictures about "How can I teleport a player to a location relative to another player?"

How can I teleport a player to a location relative to another player? - Free stock photo of adult, basketball, basketball player
How can I teleport a player to a location relative to another player? - Boy in Yellow and Black Soccer Jersey Playing Soccer
How can I teleport a player to a location relative to another player? - White and Black Round Plastic



How do you teleport entity to a player?

Players who want to move mobs to their character's position or move their character to the mob's position can use the following commands:
  • "/tp @e[type=mobtype] @p" will teleport mobs of a certain type to the closest player (usually you).
  • Typing "/tp @p @e[type=mobtype]" will move the player to them.




  • HOW TO TELEPORT OBJECTS IN UNITY 🎮 | Teleport Player and GameObjects in Unity | Unity Tutorial




    More answers regarding how can I teleport a player to a location relative to another player?

    Answer 2

    execute Joe ~ ~ ~ teleport Steve ~ ~50 ~

    for teleport command, the relative coordinate is of the executor, but not the teleported entity.

    Answer 3

    /execute Joe ~ ~50 ~ /tp Steve @p
    

    execute will make Joe execute it but the ~ ~50 ~ would make it execute 50 blocks above Joe's feet because relatives (~) on entities alway count from the bottom block (that is the case with blocks sometimes too, ie. doors and two-block plants). Steve is the parameter which tells the game who to teleport.

    Answer 4

    /execute Joe ~ ~50 ~ /tp Steve @p
    

    Answer 5

    You can do the following:

    /execute Joe ~ ~ ~ /tp Steve ~ ~50 ~
    

    I hope this helped.

    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: David Morris, Kampus Production, Omar Ramadan, Dmitry Demidov