Hello
For controlling a plane in a game, how can I get input from the default (static or dynamic) touchscreen thumbstick? Can I do this without forking the Control module?
you may try to create your own controls (like when u use pilot or driver seat in build a boat for treasure)
Making my own touch controls is exactly the thing, which I would like to avoid.
That’s why I wonder what is the best way to get input from the default touch controls
UserInputService can give you the position of the thumbstick. This code in a LocalScript listens for the state Enum.UserInputState.Change and the type Enum.UserInputType.Touch. The position gives the current distance from the center.
local UserInputService = game:GetService("UserInputService")
UserInputService.InputChanged:Connect(function(Input)
if Input.UserInputState == Enum.UserInputState.Change then
if Input.UserInputType == Enum.UserInputType.Touch then
print("TouchStick:",Input.Position)
end
end
end)
This will give me only the absolute position of the place where the player is touching.
this is not useful, as I do not know where is the center of the thumbstick, especially in case of dynamic thumbstick.
also if the player touches the screen with his other hand on the right side of the screen, this will be also detected.