What command can testfor a player looking up?

What command can testfor a player looking up? - Selective Focus Photo of Guinea Pig Holding Card

What command can test for a player looking straight up?



Best Answer

The selector arguments rx (X rotation maximum) and rxm (X rotation minimum) will let you test for a player with a certain vertical rotation. In this case, as -90 is the furthest up you can look, the command you want should be:

/testfor @a[rxm=-90]



Pictures about "What command can testfor a player looking up?"

What command can testfor a player looking up? - A Woman Holding a Volleyball
What command can testfor a player looking up? - A Man Holding a Basketball
What command can testfor a player looking up? - A Smartphone Game Controller On A Person's Hand



How do you detect what a player is looking at?

How to Enter the Command
  • Test if Players are within 10 blocks. In this example, we will test to see if there are any players within a 10 block radius with the following command: /testfor @a[r=10] ...
  • Test if Mooshrooms are within 50 blocks. ...
  • Test if Nearest Player is at Level 20 experience.


  • How do I use the Testfor player command?

    detectPos is the x y z coordinate to detect the block. command is any Minecraft command that you want the entity to execute such as summon, give, fill, clone, setblock, tp, xp, kill, etc.



    How to detect a player using command blocks! | /execute command tutorial for 1.16 Minecraft Java




    More answers regarding what command can testfor a player looking up?

    Answer 2

    Actually, that would detect anything below zero, for looking straight up you would use:

    /testfor @a[rx=-90]
    

    I would use

    /testfor @a[rx=-50]
    

    though

    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: Helena Lopes, cottonbro, Kampus Production, Joseph Redfield