I'm trying to use the /execute command to test for whether or not a player is looking at a certain location. However, I don't know how to use /execute since 1.14 came out, so I can't get it to work. In case it changes anything, what I want players to be looking at is a painting. Could anyone tell me what command to use?

  • This is very difficult and requires something called "raytracing" (one example is here. It's better to think about what you actually want to do, what's your overall project? Maybe you can work around this and don't need to detect players looking at paintings at all. – Fabian Röling Aug 23 '19 at 23:13
  • It's specifically one painting, but looking at the wall the painting is one would work too. I want the player to be looking away from a wall that disappears in a map I'm making. But I know that if I make a command block to run a command when the player faces -90 degrees, it would be too specific. What would work best would be a way to check if they are looking anywhere from one direction to another. I just hope this doesn't requires raytracing. – Leaf Aug 24 '19 at 0:14
  • You mean a view angle would be enough? Then just use a range for that, -70..-110 or so. – Fabian Röling Aug 24 '19 at 12:03
  • What command would I use to do this? – Leaf Aug 24 '19 at 15:47
  • Whatever command you want, it's a target selector argument. I thought you knew about facing angles already, didn't you say that? The "Commands" wiki page documents it. – Fabian Röling Aug 24 '19 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.