#raycasting
1 messages · Page 1 of 1 (latest)
Define "in your view", this is NOT a fixed volume as we can adjust the field of view setting and one could argue that blocks obstruct your line of vision and thus your "view".
yo bro i dont undrtsand
You have a FOV setting that changes what you see
yeh i know
Most people don't touch it but some people play with it set to quake pro, this setting changes the volume/area you have to check
but
Same with walls or pillars that can block your view, does this matter yes/no
what im trying to say is that i want a command or smth to damage the mobs im looking in a range of 20 blocks
There is no direct way to detect what the player can see
What you want requires you to define what you want more specific
Unless you only care about directly in front of the player
well atleast mae damag to every entity in the direction im looking
sry my keyboard is break
yeh i think thats what i wanrt
Directly in front would be done with a raycast
and how do i do that
i make this but as you can see is bad
Above guide works with a recursive function
Which is definitely more efficient, in the end it will boil down to do the same as what your just shared.
But you can adjust the range and step size (often we take a step size smaller than a full block)
i didnt understand but ok
its a function that loops itself and changes itself to run the commands you wrote, but at intervals of 0.1, it writes itself, but not in the code so you only have to write like 4 lines