Hello there! I’m learning trigonometry and I need some help, I found some code on this forum that checks if the camera is looking at the sun, and it also uses trigonometry, I just don’t understand why they used math.acos(), and not other inverse functions, here is the code:
local camera = workspace.CurrentCamera;
local li = game.Lighting;
local rs = game:GetService("RunService");
local tweenService = game:GetService("TweenService");
local currentlyTweening = false
function Blur()
if currentlyTweening then return end;
local blur = li.Blur;
tweenService:Create(blur,TweenInfo.new(2,Enum.EasingStyle.Sine), {Size = 24}):Play();
end;
function Unblur()
if not currentlyTweening then return end;
local blur = li.Blur;
tweenService:Create(blur,TweenInfo.new(2,Enum.EasingStyle.Sine), {Size = 0}):Play();
end;
rs.Heartbeat:Connect(function()
local cameraDirection = camera.CFrame.LookVector;
local sunDirection = li:GetSunDirection();
local angleBetweenTwoDirections = math.acos(cameraDirection:Dot(sunDirection))
if math.deg(angleBetweenTwoDirections) < 20 then
Blur();
currentlyTweening = true;
else
Unblur();
currentlyTweening = false;
end
end);
Any help would be appreciated ![]()


