I’ve never had a problem with getMouseDelta until today when all of a sudden its started returning absurdly high values.
I set my cameraMode to LockFirstPerson and MouseBehavior to LockCenter.
When my character first spawns (custom spawn, playerautoloads set to false), and I right click for the first time without moving my mouse I get absurdly high values even though my mouse is not moving.
My output:
where the first value is the deltaX and the second value is the deltaY.
This is literally the only part of my code you need to be concerned about:
local delta = uis:GetMouseDelta()
print(delta.X, delta.Y)
Now theres absolutely no way I managed to somehow move my mouse precisely 945 delta on the x axis and 430 delta on the y axis consistently for 231 frames or approx 3.85 seconds.
This isn’t a problem with my mouse, this only ever occurs in studio, and does not occur in game, and I have absolutely no clue as to why.
Only seems to stop returning the high values after moving the mouse or stopping right clicking.
I don’t know that this is a bug so much as it is you trying to read a delta before any inputs (mouse movements) have been recorded.
I would do this:
local delta = Vector3.new()
game:GetService("UserInputService").InputChanged:Connect(function(input, gp)
if not gp and input.UserInputType = Enum.UserInputType.MouseMovement then
delta = input.Delta
end
end)
And then use delta wherever you need it in the rest of the script.
I was previously using this method, however I did’t like how it looked, but since it looks like I may be forced to use it, I’ll have to re implement it.
Disappointed nonetheless, but atleast theres a solution ,even if its not the nicest looking