Hiwiwi!
Im trying to create a custom touch user input. Similar to the Roblox default DynamicThumbstick
Working “fine”. But, how to specify a zone for the “GUI”? You know, a little black “circle”/“box” where the input is listened.
Right now Im just using UserInputService.TouchMoved
. And obviuosly is working in the whole screen, no matter where the touch is occuring, I want to set a limit “box” for the input, exactly like the original DynamicThumbstick
, a little Black Box limiting the input zone at the lower left corner.
Its by using a GUI? and then what? somekind of GUI on touched event?
Thank you for ur time
1 Like
According to the event on the Dev reference API the event function returns a touch object which you can use like so in the example script:
local UserInputService = game:GetService("UserInputService")
function onTouchMoved(touch, gameProcessedEvent)
local oldPosition = touch.Position - touch.Delta
print("Touch moved from " .. tostring(oldPosition) .. "to " .. tostring(touch.Position))
end
UserInputService.TouchMoved:Connect(onTouchMoved)
This means you enable the function through an if statement, like so in psuedo code, in order to limit the input zone:
if touch.Position is within the GUI box coordinate boundries then
-- do your thing here
end
2 Likes
Ohhh yeah!! So obvious!! Just limit the zone by script :v
Yup well, all the touch input is working perfect, Im building a custom vehicle seat to drive my plane. Cause the default VehicleSeat in roblox is very glitchy. And everything is working fine, my problem was A way to limit the input zone.
So its only about “If touch.position is within a GUI coordinate!” thank you so much!
1 Like