How to spawn an entity behind another entity based on where it is facing [duplicate]

I am wondering how to spawn an entity behind another one but it does it based on where the entity is facing

1

1 Answer

Use the new caret notation. Tildes (~ ~ ~) use global positioning and carets (^ ^ ^) use local positioning. So the command looks like this:

/execute as <someEntity> at @s run summon <entity> ^ ^ ^-1

The first caret is for left and right, the second one is for up and down, and the third one is for forward and backward. So ^ ^ ^-1 means 1 block behind the entity (regardless of its rotation).

You Might Also Like