Hello, rather simple question:
If I have the following example code which calculates basic line of sight from a dummy to a player, what is a good way to convert the dot product’s threshold (0.4 in the example below) to degrees/radians and back?
Are there any charts online that people have made for such a thing?
game:GetService("Players").PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
while task.wait() do
local dummyUnit = (character.Head.Position - workspace.Dummy.Head.Position).Unit
local dummyLookVector = workspace.Dummy.Head.CFrame.LookVector
local dotProduct = dummyUnit:Dot(dummyLookVector)
if dotProduct > 0.4 then -- what is the maximum angle here?
print("in line of sight")
else
print("not in line of sight")
end
end
end)
end)