-- BaseCamera mod


local BaseCamera = require(baseCameraModule)

BaseCamera.UpCFrame = IDENTITYCF

function BaseCamera:UpdateUpCFrame(cf)
	self.UpCFrame = cf
end

function BaseCamera:CalculateNewLookCFrame(suppliedLookVector)
	local currLookVector = suppliedLookVector or self:GetCameraLookVector()
	currLookVector = self.UpCFrame:VectorToObjectSpace(currLookVector)
	
	local currPitchAngle = math.asin(currLookVector.y)
	local yTheta = math.clamp(self.rotateInput.y, -MAX_Y + currPitchAngle, -MIN_Y + currPitchAngle)
	local constrainedRotateInput = Vector2.new(self.rotateInput.x, yTheta)
	local startCFrame = CFrame.new(ZERO, currLookVector)
	local newLookCFrame = CFrame.Angles(0, -constrainedRotateInput.x, 0) * startCFrame * CFrame.Angles(-constrainedRotateInput.y,0,0)
	
	return newLookCFrame
end
