Im trying to make an auto turret but when teleporting the entity in place and making it face another using the tp "facing" argument it faces the entity's feet, this is annoying because when the entity gets far enough away the arrows will undershoot seeing as the target is the feet
How do I make it face the head so it will be more accurate?
This is my code:
/execute as @e[tag=AS] at @s anchored eyes run tp @s ~ ~ ~ facing entity @e[tag=!ASUser,limit=1,sort=nearest,distance=0.1..,type=!minecraft:arrow,type=!minecraft:item,type=!minecraft:experience_orb]
Best Answer
Rotating an entity so that the looking direction goes from its feet to something else's feet (the normal case):
Rotationg an entity so that the looking direction goes from its feet to something else's eyes (usually looking up, which I assume you want here):
Rotating an entity so that the looking direction goes from its eyes to something else's feet (usually looking down, the entity looks at the other entity's feet):
Rotating an entity so that the looking direction goes from its eyes to something else's eyes (which might be different from the first case because eye heights can differ):
The teleport syntax with
facing
is a bit tricky, because autocomplete doesn't work and the instant validation keeps claiming that you're doing something wrong, pretty much all the way until you finish typing the command, when it turns out that it was right all along.Here is the bug report about it: https://bugs.mojang.com/browse/MC-124053
The game's log also includes a warning about the conflicting syntax every single time the game is started, so Mojang probably knows about it.