How to Detect Where the Player is Looking in Minecraft
We cover how to detect when a player is looking at an entity or block using a command block and raycasting method.
π‘ 1 Command Code: execute as @p at @s anchored eyes facing entity @e[sort=nearest,limit=1,type=!player] eyes anchored feet positioned ^ ^ ^1 rotated as @s positioned ^ ^ ^-1 if entity @s[distance=..0.3] run effect give @e[type=!player,sort=nearest,limit=1] glowing 10 10 true
π‘ Raycasting Command: execute if score @s range matches 1.. if block ~ ~ ~ air positioned ^ ^ ^0.5 run function test:look
π‘ Raycasting Hitbox: execute as @e[dx=0] positioned ~-0.99 ~-0.99 ~-0.99 if entity @s[dx=0] run effect give @s glowing 1 1 true
πNew Challenge:
Easy β‘οΈ Make creepers explode when you look at them for too long.
βοΈ Server IP: cloudgames.ml
π΅ Discord Server: https://discord.gg/HyZPCTu
π» Website: https://dtdeadpool.wixsite.com/cloudgames
πΊ Twitter: https://twitter.com/cloudwolfbane
π§ Email: dt.deadpool@gmail.com
Music:
"Werq" Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 4.0 License
All Songs Used under fair copyright. Lincenses Below:
License for commercial use: Creative Commons Attribution 4.0 Unported "Share Alike" (CC BY-SA 4.0) License.
Full License HERE - https://creativecommons.org/licenses/by-sa/4.0/legalcode
Other Videos By Cloud Wolf
Other Statistics
Minecraft Statistics For Cloud Wolf
Currently, Cloud Wolf has 8,312,436 views for Minecraft across 523 videos. There's over 3 days worth of watchable video for Minecraft published on his channel, or 95.89% of the total watchable video on Cloud Wolf's YouTube channel.