How to Detect Where the Player is Looking in Minecraft

Channel:
Subscribers:
33,600
Published on ● Video Link: https://www.youtube.com/watch?v=fGlJpli5cYc



Minecraft
Game:
Minecraft (2011)
Duration: 16:12
71,270 views
0


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







Tags:
Minecraft
How to
Tutorial
Detect Looking
Command Block
Function
Datapack



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.