When panning with one finger and then panning with a second finger, the position of the first finger suddenly glitches away by over 40 pixels. This makes it hard to track the position of the first finger, for example for a custom thumbstick UI. I’ve made an example place that shows the positions in a red Textlabel on the screen. Join it on mobile and pan around with two fingers and see how the first position suddenly changes after the second fingers moves around.
Here is the code that tracks the positions:
local UIS = game:GetService("UserInputService")
local debuglabel = script.Parent.DebugLabel
UIS.TouchPan:Connect(function(positions:{Vector2},translation,velocity,state,gameProcessed)
debuglabel.Text = ""
for i,v in positions do
local x,y = math.round(v.X),math.round(v.Y)
debuglabel.Text ..= `{x}, {y}\n`
end
end)
Expected behavior
The second finger should not affect the position of the first finger.
The issue with panning with 2 fingers seems to be fixed now, however there’s a new bug now where the position is offset to the bottom right. Here’s a screen recording:
The red point represents the Vector2 position given by the TouchPan event. I simply added this code to the code given in the original post:
local pos1 = positions[1]
if pos1 then
script.Parent.TextLabel.Position = UDim2.fromOffset(pos1.X,pos1.Y)
end
The red point should be centered to where the user is touching on the screen and without an offset.
Hi Nickhz, you’re right that the initial fix now has the wrong coordinate system for the position. We’ve undone that change and will update you when we have another fix.