pretty clear and to the point, how can i limit how quickly a player moves their mouse around?
This should solve your problem
that just flat-out lowers it at all times, i want something that will adjust sensitivity to avoid spinning around too much
Just an idea, but maybe a function that connects once it detects the player’s mouse input changing over some threshold in a time frame (rapidly moving) and adds a check of if the player’s orientation is changing, then we dampen the movement.
thinking that too but don’t know where to start
Why though? This seems pretty pointless to me
In a LocalScript, you can use the UserInputService to cap out your MouseDeltaSensitivity. Get the mouse delta and check if the Magnitude is past 1. If it is, check how far past it is by dividing the velocity by the max velocity. If it’s lower than or equal to 1, set it to 1. Now set our MouseDeltaSensitivity to that new sensitivity.
I have created a quick scripts that achieves this:
local uis = game:GetService("UserInputService")
local max = 1 -- Set the maximum turn velocity
local baseMultiplier = 0.5 -- Multiplies the end multiplier by this number to make the camera even slower past the max
local lastPos = Vector2.zero
game:GetService("RunService").PreRender:Connect(function()
local pos = uis:GetMouseDelta() -- Get our delta (works for locked mouse)
local movement = (if uis:GetMouseDelta().Magnitude > 0 then uis:GetMouseDelta().Magnitude else (pos - lastPos).Magnitude) -- If the mouse is locked, get the delta using the current position minus the last position, then use magnitude to get the velocity
local percentPassed = movement / max -- How far past we are in a percent
if percentPassed <= 1 then -- If the percent is under the max, leave it at 1
percentPassed = 1
end
local multiplier = 1 / percentPassed -- Get the multiplier
uis.MouseDeltaSensitivity = multiplier * baseMultiplier -- Set our sensitivity multiplied by our baseMultiplier
lastPos = pos
end)
I hope I was able to help!
well, various reasons. for example, in the game Bulwark they limit how quickly you can swing your sword around to prevent being able to not react to anything that’s coming and also prevent people getting punished by people swinging their sword backwards 180 degrees last moment
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.