function utils.LookAt(Camera: Camera, Object: Model, FOV: number?, Offset: Vector3?): (CFrame, CFrame)
local isModel = Object:IsA("Model") or Object:IsA("Tool")
local CF: CFrame = (isModel and Object:GetPivot()) or Object.CFrame
local Pos = CF.Position + (Offset or Vector3.new())
local Size: Vector3 = (isModel and Object:GetExtentsSize()) or Object.Size
local halfSize = Size.Magnitude / 2 + (FOV and FOV / 25 or 0)
local fovDivisor = math.tan(math.rad(Camera.FieldOfView / 2))
local Offset = halfSize / fovDivisor
local Rotation = Camera.CFrame - Camera.CFrame.Position
return Rotation + Pos + (-Rotation.LookVector * Offset), Rotation + Pos
end
If I change the CFrame.Angles thing to this: local rot = CFrame.Angles(0, math.rad(rotation), math.rad(-45) it looks very weird while rotating.