Camera panning is one-frame-off from input when Workspace.SignalBehavior is set to Deferred

Issue Type: Display
Impact: Low
Frequency: Often
Date First Experienced: 2021-05-20 00:05:00 (-06:00)
Date Last Experienced: 2021-05-20 00:05:00 (-06:00)

Reproduction Steps:
This is something you can really feel on mobile devices with framerates under 30 FPS.

But, if you want to test it empirically, create a LocalScript in game.StarterPlayerScripts with the following code (requires desktop device):

local holdingRightClick = false
game:GetService('UserInputService').InputBegan:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton2 then
		holdingRightClick = true
	end
end)
game:GetService('UserInputService').InputChanged:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseMovement
	and holdingRightClick then
		print('Mouse movement', os.clock())
	end
end)
game:GetService('UserInputService').InputEnded:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton2 then
		holdingRightClick = false
	end
end)

game.Workspace.CurrentCamera:GetPropertyChangedSignal('CFrame'):Connect(function()
	print('Camera CFrame changed')
end)

Next, pan your camera sharply, such that the camera ends up in a steady state where the CFrame doesn’t change after the end of the movement.

Expected Behavior:
If there is a off-by-one frame error, you would expect the camera to move multiple times after panning the camera to the stable position.
This will result in a multiplicity of “Camera CFrame changed” printouts after the last “Mouse movement” printout:
image

If there isn’t an off-by-one frame error, you would expect to be able to achieve a single printout of “Camera CFrame changed” after the last “Mouse movement” printout:

image

Actual Behavior:
When SignalBehavior is set to Immediate, you can very consistently get a single “Camera CFrame Changed” printout after the last “Mouse movement” printout, and this is achievable for any magitude of mouse movement, by stopping the mouse very sharply after a movement:
image

Note that this doesn’t always happen when SignalBehavior is set to Immediate, but it almost never happens when SignalBehavior is set to Deferred.

When SignalBehavior is set to Deferred, I’ve consistently seen a multiplicity of “Camera CFrame Changed” printout after the last “Mouse movement” printout, but only been able to achieve a single printout for very small mouse movements, indicating that for most panning mouse movements, there is an off-by-one frame error.

My guess of where to start:

Workaround:
Set the SignalBehavior to Immediate.

5 Likes

You somehow beat me to it. I am experiencing the same. Thanks for the workaround.

Thanks for the report! We’ve filed a ticket to our internal database and we’ll follow up when we have an update for you.

2 Likes