TouchMoved passes a Vector3 instead of a Vector2

Repro code:

--!strict
local insetBottom, _ = game.GuiService:GetGuiInset()

game.UserInputService.TouchMoved:Connect(function(touch: InputObject, gpe)
	if not gpe then 
		print("touchPos:"..tostring(touch.Position)..", inset: "..tostring(insetTop))
				
		self.TouchPosition = touch.Position :: Vector2 - insetBottom --you will notice this warn us saying its a Vector3
	end
end)

Expected behavior

According to the documents its supposed inputObject.Position is a Vector2, however it passes a Vector3 as seen in the given image. Occurs in game(like in image) as well as in studio!

That specific line in the Docs is incorrect, if you check the page for InputObject.Position, you can see it’s documented as a Vector3:

image

I am aware of at least one place in which the Z component is used, which is for Mouse Scroll events with UserInputService.InputChanged.

1 Like

Expected behavior.

InputObject’s Position property is always a Vector3 even though not every event type uses all three components of the Vector3 for something.

3 Likes