#teleporting model behind player but same y level

1 messages · Page 1 of 1 (latest)

junior folio
#

execute as Horma_ at @s run tp @e[type=minecraft:item_display,limit=1,sort=nearest] ^ ^ ^-0.45 ~ ~
execute at Horma_ run execute as @e[type=minecraft:item_display,sort=nearest,limit=1] at @s run tp @s ~ ~0.5 ~ ~ 0

this makes the item display teleport behind the player but looking up and down will make it move in front or behind, or higher or lower and this ruins the issue that putting it behind solves, which is to hide the model from the player wearing the item display

how can i make it 0.45 blocks behind the view direction but same y position as player?

junior folio
#

i'm on 1.21.11 btw

kind cove
#

You can change the rotation of the execution : execute rotated ~ 0

execute as player at @s rotated ~ 0 positionned ^ ^ ^-0.45 run tp @n[type=minecraft:item_display] ~ ~0.5 ~. This should produce the same result as your commands

junior folio
fringe flicker
#

That is what rotated ~ 0 does. The first argument is yaw, the second is pitch.

#

Just make sure you do not call at @s afterwards as it is shorthand for: positioned as @s rotated as @s this is why the ~ is there and works. you already have the player rotation as your executor rotation.

kind cove