if you want it to only check every few seconds, just do
while task.wait(3) do
FOVCast()
end
if you want it to only check every few seconds, just do
while task.wait(3) do
FOVCast()
end
Personally, I don’t think anybody should be using next
in a for
loop. I have been programming for several years on Roblox, and yet I still have no idea why it’s used, why it exists or the syntax for even using it. I prefer to use the “generic iteration” syntax:
for _, Player in Players:GetPlayers() do
, which I feel like is less visually cluttered and, reading through it, makes more sense:
for Players in next Players:GetPlayers
vs
for Player in Players:GetPlayers
Other than that, I think this tutorial is pretty good. +1
as the distance of the target from the origin increases, the field of view boundaries increases. this is a directly proportional relation. as this distance D increases let there be two vector2 values, C which denotes the maximum boundary, and T which denotes the minimum boundary. let B be D divided by the maximum distance the npc can see, yielding a [0,1] value and the limitation is that the target must be in front of the origin.
let H be a value which influences how much B is multiplied by
let G be B*H
as B changes, C = v2(G, G), T = v2(-G, -G). you can take the relative position of the target from the origin and check if the targets position is within T and C based on the targets X and Y position
bruh its fine it doesn’t matter as long as it works and isn’t unreadable
It’s just a small nitpick. I’m not attacking them, I’m just sharing my thoughts.
(post deleted by author)
(post deleted by author)
if you mean generalized iteration, it is fairly new to luau, being introduced a year ago, and should be used over an iterator such as next or iterator function such as pairs
(post deleted by author)
(post deleted by author)
I thought this line should be FOV/2 and Guard = NPC.
But your code is great. Thanks.
if Angle <= FOV/2 and Distance <= Range and CheckLineOfSight(NPC.Head.Position, Character.Head.Position) then
(post deleted by author)
Thanks for your feedback.
I see that:
local NPCToCharacterFlatten = NPCToCharacter * vector3.new(1,0,1)
local NPCLookVectorFlatten = NPCLookVector * vector3.new(1,0,1)
local DotProduct = NPCToCharacterFlatten:Dot(NPCLookVectorFlatten)
(post deleted by author)
Wait can I ask,I want to check if a dead body/corpse is in the vision so I can make like withnessers. How do I do that?
(post deleted by author)
(post deleted by author)
Hello everyone! I completely rewrote this tutorial with better code and a cleaner layout.
Hi,
Can you provide a .rbxl or editable demo place?
Thanks
That defeats the purpose of following the tutorial!