<commit_before>local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService  = game:GetService("UserInputService")
local ContextActionService  = game:GetService("ContextActionService")
local RunService = game:GetService("RunService")

local NevermoreEngine   = require(ReplicatedStorage:WaitForChild("NevermoreEngine"))
local LoadCustomLibrary = NevermoreEngine.LoadLibrary

local MakeMaid = LoadCustomLibrary("Maid").MakeMaid
local AccelTween = LoadCustomLibrary("AccelTween")
local Signal =  LoadCustomLibrary("Signal")

-- Intent: Interface between user input and camera controls



--- Handles gamepad rotation
-- See: https://github.com/Roblox/Core-Scripts/blob/cad3a477e39b93ecafdd610b1d8b89d239ab18e2/PlayerScripts/StarterPlayerScripts/CameraScript/RootCamera.lua#L395
local GamepadRotate = {}
GamepadRotate.__index = GamepadRotate
GamepadRotate.ClassName = "GamepadRotate"

function GamepadRotate.new()
	local self = setmetatable({}, GamepadRotate)
	
	self.DEADZONE = 0.1
	self.SpeedMultiplier = Vector2.new(0.1, 0.1)
	
	self.RampVelocityX = AccelTween.new(5)
	self.RampVelocityY = AccelTween.new(5)
	
	self.IsRotating = Instance.new("BoolValue")
	self.IsRotating.Value = false
	
	return self
end

do
	-- K is a tunable parameter that changes the shape of the S-curve
	-- the larger K is the more straight/linear the curve gets
	local k = 0.35
	local lowerK = 0.8
	function GamepadRotate: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
end

function GamepadRotate:ToSCurveSpace(t)
	return (1 + self.DEADZONE) * (2*math.abs(t) - 1) - self.DEADZONE
end

function GamepadRotate:FromSCurveSpace(t)
	return t/2 + 0.5
end
<commit_msg>Move ugly documentation<commit_after>local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService  = game:GetService("UserInputService")
local ContextActionService  = game:GetService("ContextActionService")
local RunService = game:GetService("RunService")

local NevermoreEngine   = require(ReplicatedStorage:WaitForChild("NevermoreEngine"))
local LoadCustomLibrary = NevermoreEngine.LoadLibrary

local MakeMaid = LoadCustomLibrary("Maid").MakeMaid
local AccelTween = LoadCustomLibrary("AccelTween")
local Signal =  LoadCustomLibrary("Signal")

-- Intent: Interface between user input and camera controls

local GamepadRotate = {}
GamepadRotate.__index = GamepadRotate
GamepadRotate.ClassName = "GamepadRotate"

function GamepadRotate.new()
	local self = setmetatable({}, GamepadRotate)
	
	self.DEADZONE = 0.1
	self.SpeedMultiplier = Vector2.new(0.1, 0.1)
	
	self.RampVelocityX = AccelTween.new(5)
	self.RampVelocityY = AccelTween.new(5)
	
	self.IsRotating = Instance.new("BoolValue")
	self.IsRotating.Value = false
	
	return self
end

do
	-- See: https://github.com/Roblox/Core-Scripts/blob/cad3a477e39b93ecafdd610b1d8b89d239ab18e2/PlayerScripts/StarterPlayerScripts/CameraScript/RootCamera.lua#L395
	-- K is a tunable parameter that changes the shape of the S-curve
	-- the larger K is the more straight/linear the curve gets
	local k = 0.35
	local lowerK = 0.8
	function GamepadRotate: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
end

function GamepadRotate:ToSCurveSpace(t)
	return (1 + self.DEADZONE) * (2*math.abs(t) - 1) - self.DEADZONE
end

function GamepadRotate:FromSCurveSpace(t)
	return t/2 + 0.5
end

{'fraction_non_alphanumeric': 0.10834762721555175, 'fraction_numerical': 0.02801600914808462, 'mean_word_length': 5.171075837742505, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3820824', 'n_tokens_mistral': 1299, 'n_tokens_neox': 1218, 'n_words': 269}