:GetMouseDelta() returns absurdly incorrect values with .LockCenter

This bug only occurs in studio, hence why this is studio bug report not an engine bug report.
My game uses a custom camera and character system, so I’ll try to include only relevant information.
When my player spawns, using load character, I set the mouse behaviour to lock center, and I set the camera mode to lock first person.
When I click the left mouse button, :GetMouseDelta() returns completely false delta values. When tested it says the mouse delta was 770[x] 321[y] (6 frames) even though my mouse was completely still.
When right clicking same thing happens and I get delta 945 430 (114 frames) even though my mouse is completely still.
The only way for it to stop returning these values is to move the mouse or stop clicking. After this occurs once it doesn’t occur again. Only one time and only ever in studio.

This only started occuring today as far as I’m aware. I have reverted my place bhack to when I knew this issue did not occur, and the same problem happened.

Video:
https://streamable.com/5gynzd

Reproduction steps:
Create local script in starterplayerscripts
Copy the following code:

local userInputService = game:GetService("UserInputService")
local runService = game:GetService("RunService")
local player = game:GetService("Players").LocalPlayer
local camera = workspace.CurrentCamera
userInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
camera.CameraType = Enum.CameraType.Scriptable
runService.RenderStepped:Connect(function()
	local delta = userInputService:GetMouseDelta()
	print(delta.X, delta.Y)
end)

Hold right mouse button
Observe incorrect mouse values

I would like to note, this seems to an issue with lockcenter in studio, and is an issue that has not yet been fixed, despite multiple reports.

https://devforum.roblox.com/t/anybody-else-having-trouble-with-lockcenter-in-studio/34963

2 Likes

Thanks for the report! This on our radar and will be looking into fixing shortly.

2 Likes

This might be related as well, in case you missed it: UserInputService:GetMouseDelta() broken in Studio

4 Likes