local T=.35 local E=.8 local function i(i)i=math.clamp(i,-1,1)if i>=0 then return(T*i)/((T-i)+1)end return-((E*-i)/((E+i)+1))end local C=.1 local function W(T)return(1+C)*(2*math.abs(T)-1)-C end local function r(T)return T/2+.5 end function CameraUtils.GamepadLinearToCurve(T)local function E(T)local E=1 if T<0 then E=-1 end local C=r(i(W(math.abs(T))))C=C*E return math.clamp(C,-1,1)end return Vector2.new(E(T.x),E(T.y))end

local k = 0.35
local lowerK = 0.8
local function SCurveTranform(t)
	t = math.clamp(t, -1, 1)
	if t >= 0 then
		return (k*t) / (k - t + 1)
	end
	return -((lowerK*-t) / (lowerK + t + 1))
end

local DEADZONE = 0.1
local function toSCurveSpace(t)
	return (1 + DEADZONE) * (2*math.abs(t) - 1) - DEADZONE
end

local function fromSCurveSpace(t)
	return t/2 + 0.5
end

function CameraUtils.GamepadLinearToCurve(thumbstickPosition)
	local function onAxis(axisValue)
		local sign = 1
		if axisValue < 0 then
			sign = -1
		end
		local point = fromSCurveSpace(SCurveTranform(toSCurveSpace(math.abs(axisValue))))
		point = point * sign
		return math.clamp(point, -1, 1)
	end
	return Vector2.new(onAxis(thumbstickPosition.x), onAxis(thumbstickPosition.y))
end
