I’m currently making a line of sight system and i got it to work in only one axis.
The reason is that im utilizing a single ray raycast and then i noticed that there is something called “DotProduct()”
How could i get to combine dotproduct into this code:
local part = script.Parent.Head
local rayDirection = part.CFrame.LookVector * 30
while task.wait() do
local raycastResult = game:GetService("Workspace"):Raycast(part.Position, rayDirection)
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Blacklist
params.FilterDescendantsInstances = script.Parent:GetChildren()
if raycastResult and game.Players:GetPlayerFromCharacter(raycastResult.Instance.Parent) then
print("found ".. raycastResult.Instance.Name)
else
print("wheres")
end
end
(ik im using a outdated raycast system and using task.wait(), you can fix it if you want to)