Impossible to Adjust Gamepad Sensitivity Using Script?

I am working on a gun system that relies on decreasing mouse sensitivity while aiming. To currently achieve this effect, I am manipulating MouseDeltaSensitivity. This works great for PC and mobile, however it has no effect on gamepad thumbstick sensitivity.

I have been researching for a while and only solution I have seen is to modify roblox’s camera script. Here is the link to that post Gamepad equivalent of UIS.MouseDeltaSensitivity?

I tried looking through the camera script a bit to find some variable I could tweak but have not had any luck. Any leads for this topic would be much appreciated. At a bit of a dead-end currently.

1 Like

A Roblox Staff member responded to the post you sent, and said you could manipulate GamepadCameraSensitivity - will this suit your case? Is it there in the camera script?

1 Like

It might suit my case if I could figure out how to manipulate it. As I said in my original post, I have looked through the camera script and have not found a way to change it yet. If you are aware of a way I could manipulate this value please let me know.

1 Like

Just an update on my research in case someone references this thread in the future:

I have looked into GamepadCameraSensitivity. It is a usersetting that cannot be manipulated via code. (at least not easily) When you attempt to set it via script you get a “Permission missing” warning because it is read only.

I have done more digging in the camera modules looking for a place where this variable is set, but have been unsuccessful finding its location. This is likely by design since roblox does not want developers manipulating the user’s settings. Please let me know if anyone has a lead on this topic.

1 Like

You should use UserInputService to handle input from the player.
UserInputService.MouseDeltaSensitivity will get and set mouse sensitivity, and UserInputService.GamepadRightStickSensitivity will get and set gamepad stick sensitivity.
You can also get the sensitivity value from UserGameSettings and set it to UserGameSettings to save it.

1 Like

Could you please provide a link where you found information for any of this? Or even a 1-4 line code snippet of how this could be achieved? I did some research and testing with the solutions you provided and I do not think they are correct. (I greatly appreciate your response regardless) UIS.GamepadRightStickSensitivity doesn’t appear to even be a real property of UIS, and to my knowledge it is impossible to write to UserGameSettings via a script. Please let me know if you have any more info. Thanks

I know it’s bad form to revive an old topic, but I had this same question. After looking through the camera scripts, here’s what I found…

To answer the OP’s question: No, there isn’t. Here’s why:

The right thumbstick (Thumbstick2) is tied to the camera via ContextActionService in the CameraInput module. This is on line 212 of the camera input module:

		local function thumbstick(action, state, input)
			local position = input.Position
			gamepadState[input.KeyCode.Name] = Vector2.new(thumbstickCurve(position.X), -thumbstickCurve(position.Y))
			return Enum.ContextActionResult.Pass
		end

The function thumbstickCurve is interesting because it takes the delta input of the thumbstick and modifies it according to what appears to be an exponential curve with a dead zone. This is on line 56 of the camera input module:

local thumbstickCurve do
	local K_CURVATURE = 2 -- amount of upwards curvature (0 is flat)
	local K_DEADZONE = 0.1 -- deadzone

	function thumbstickCurve(x)
		-- remove sign, apply linear deadzone
		local fDeadzone = (math.abs(x) - K_DEADZONE)/(1 - K_DEADZONE)
		
		-- apply exponential curve and scale to fit in [0, 1]
		local fCurve = (math.exp(K_CURVATURE*fDeadzone) - 1)/(math.exp(K_CURVATURE) - 1)
		
		-- reapply sign and clamp
		return math.sign(x)*math.clamp(fCurve, 0, 1)
	end
end

So from top to bottom, it starts in CameraModule using a RunService:RenderStepped(). This calls the update function of the current camera controller, which we will say is ClassicCamera, which inherits from BaseCamera. ClassicCamera calls CameraInput:GetRotation() where the various inputs are returned. Keyboard, Touch, Mouse, and Gamepad are all converted into a unified format and the values for the active controls are returned. Once CameraModule gets the new CFrame and the camera subject, it updates the camera with those values.

In short, the gamepad sensitivity is hard-coded by the thumbstickCurve function listed above.

So the only way to adjust the gamepad sensitivity is to modify Roblox’s camera scripts because that’s where it’s defined at. From what I can discern from the scripts, it appears that Touch inputs are handled the same way. So the only sensitivity that we can easily adjust is for the mouse because that’s part of UserInputService. What I think happened is that when Roblox first came out, keyboard and mouse were all that there was. Then touch screens came along with the first iPhone then console support. So instead of Roblox adding them fully to UserInputService, they use scripts as a kind of addon for the new input control types and never went back and made them full and recognized input type in UserInputService.

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.