function CharacterRealism.ComputeLookAngle(V,g,e)local y,b,p=0,0,1 if not g then local e=workspace.CurrentCamera g=e.CFrame.LookVector end if g then local e=V.Player.Character local p=e and e:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")if p and p:IsA("\066\097\115\101\080\097\114\116")then local e=p.CFrame y=-e.RightVector:Dot(g)end b=g.Y end if e then p=e end y*=p b*=p return y,b end
-- Computes the look-angle to be used by the client.
-- If no lookVector is provided, the camera's lookVector is used instead.
-- useDir (-1 or 1) can be given to force whether the direction is flipped or not.

function CharacterRealism:ComputeLookAngle(lookVector, useDir)
	local pitch, yaw, dir = 0, 0, 1

	if not lookVector then
		local camera = workspace.CurrentCamera
		lookVector = camera.CFrame.LookVector
	end

	if lookVector then
		local character = self.Player.Character
		local rootPart = character and character:FindFirstChild("HumanoidRootPart")

		if rootPart and rootPart:IsA("BasePart") then
			local cf = rootPart.CFrame
			pitch = -cf.RightVector:Dot(lookVector)
		end

		yaw = lookVector.Y
	end

	if useDir then
		dir = useDir
	end

	pitch *= dir
	yaw *= dir

	return pitch, yaw
end
