1
Hi All,
I think I need some help understanding the facing command. Basically I need to summon armor stands with a tag based on the direction I am facing.
a long time ago, we used to use /execute @p[rym=136,ry=-135]... if we wanted to detect if the player was facing north
In 1,17 it appears that the new syntax is uses something like /execute as @p facing ~136 ~ ~-135 run say Facing North Obviously this doesn't work. But how do you go about executing based on player direction. In my case I only need to detect North, East, South, West
Thanks in advance
I think I need some help understanding the facing command. Basically I need to summon armor stands with a tag based on the direction I am facing.
a long time ago, we used to use /execute @p[rym=136,ry=-135]... if we wanted to detect if the player was facing north
In 1,17 it appears that the new syntax is uses something like /execute as @p facing ~136 ~ ~-135 run say Facing North Obviously this doesn't work. But how do you go about executing based on player direction. In my case I only need to detect North, East, South, West
Thanks in advance
Create an account or sign in to comment.
5
Thanks for the additional examples and explanation. I haven't found the wiki for x_rotation and y_rotation yet. My google-fu must be horrible in my old age. I think your responses should be enough to help me figure out what I need to do.
Basically I am trying to make utility commands to help setup a map with game pieces that require an armor stand to be tagged with a direction. Since there will be more than just a few armor stands to setup, I think a utility that automatically tags the stand when summoned will help quite a bit.
Thank you
Basically I am trying to make utility commands to help setup a map with game pieces that require an armor stand to be tagged with a direction. Since there will be more than just a few armor stands to setup, I think a utility that automatically tags the stand when summoned will help quite a bit.
Thank you
/execute as @p facing ~136 ~-135 runs the command as the player, but facing somewhere else
so if you were to do something like spawn a particle or summon an entity, or tp the player to itself, itll do that thinking the player is facing the specific direction when the player is looking elsewhere.
e.g. "execute as @p at @s facing ~136 ~-135 run tp @s ~ ~ ~ ~ ~" will tp the player to the same location but facing those directions.
so if you were to do something like spawn a particle or summon an entity, or tp the player to itself, itll do that thinking the player is facing the specific direction when the player is looking elsewhere.
e.g. "execute as @p at @s facing ~136 ~-135 run tp @s ~ ~ ~ ~ ~" will tp the player to the same location but facing those directions.
/execute if entity @p[y_rotation=-135..-45] run say test
where y_rotation can be -315..-225, -225..-135 or -360..-315 representing the four directions
where y_rotation can be -315..-225, -225..-135 or -360..-315 representing the four directions
There is a x_rotation and y_rotation tag for target selector just use them
Can you give an example? I read about <pos> values on the wiki but it makes no sense the code completion wasnt much help. Or at least I didn't understand it. Google searches reveal results for ray tracing or examples from 4-8 years ago not finding any current results.