--------------------[ CAMERA RENDERING FUNCTIONS ]-----------------------------------


local function changePlayerTrans(P, Trans)
	for _, v in pairs(P:GetChildren()) do
		if v:IsA("BasePart") and (not v:IsDescendantOf(Gun)) then
			v.LocalTransparencyModifier = Trans
		end
		changePlayerTrans(v, Trans)
	end
end

local function getYawPitch(Cf)
	local LV = Cf.lookVector
	local Yaw = math.atan2(LV.x, -LV.z)
	local Pitch = math.atan(LV.y / -math.sqrt((LV.x ^ 2) + (LV.z ^ 2)))
	return Yaw, Pitch
end

local function getTotalCamOffset()
	return camOffsets.guiScope.Rot + camOffsets.Reload.Rot + camRecoilSpring.p
end

function renderCamera()
	local finalCamOffset = getTotalCamOffset()
	Cam.CameraType = Enum.CameraType.Scriptable
	Cam.CoordinateFrame = CF(Head.Position) * CFANG(0, camAng.X + finalCamOffset.X, 0) * CFANG(camAng.Y + finalCamOffset.Y, 0, 0) * CF(0, 0, 0.5)
	Cam:SetRoll(crawlCamRot + finalCamOffset.Z)
end
