How do I teleport an entity to the player's height?
I want to teleport an armor stand with this command:
execute as @p at @s run tp @e[type=minecraft:armor_stand] ^ ^ ^3
This works well when the player is looking straight. But when the player looks down or up the armor stand moves up and down with the player’s eyes. So how can I teleport it level to the player, no matter how far up/down they are looking?
Solution 1:
You will need to execute the command using the rotated
subcommand to force the command to execute as if the player is not looking up and down. However, because you need to provide both a horizontal and a vertical rotation, you can use tilde ~
notation to choose not to override horizontal rotation.
/execute as @p at @s rotated ~0.0 0.0 run tp @e[type=armor_stand] ^ ^ ^3