I don’t believe there are any KeyCodes or UserInputTypes that refer to the dynamic/virtual joystick for mobile devices. However if you take a look at the DynamicThumbstick module in the new PlayerModule hierarchy, you can figure out how they handle the movement with it (you can also disable it through this module, it seems)
You can utilize ContextActionService to Bind and Unbind Enum.UserInputType.Touch and return Enum.ContextActionResult.Sink if it does not meet your requirements, which should stop it from going through to interfering with your system.
I haven’t put any of this to the test, just throwing some ideas at you to work off of.
it would still interfere and i want to be able to pan the camera up and down , another way i thought of doing this is detecting if the the touch input is happening form the right side of the Screen as thats what most mobile games which uses 3rd Person camera do and i could use the dynamic thumbstick since it only detects control inputs form the left. how do i do this?
(the optimal way) keep the default camera system but restrict movement on the x and y axis by setting it to the desired position every frame.
(the kind of hacky way) detect your touch input on the right side of the screen by getting the position of the touch through InputChanged (as you had originally):
UserInputService.InputChanged:Connect(function(input_object)
if input_object.UserInputType == Enum.UserInputType.Touch then
if input_object.Position.X >= screen_size.X/2 then -- it's on the right side of the screen.
-- do your logic
end
end
end)
You’d get screen size by checking the AbsoluteSize on a ScreenGui or workspace.CurrentCamera.ViewportSize
Another thing you can do is track when the player is using the touch movement inputs. This is pretty much the equivalent of tracking if you’re dragging a GUI element or not (except without the dragging).
Here’s some example code:
local playerModule = require(game.Players.LocalPlayer.PlayerScripts.PlayerModule);
local control = playerModule:GetControls();
-- dragger objects have a property called isDragging and a method onDrag to define the behaviour of the drag
local dragger = require(script:WaitForChild("dragger"));
function dragger:onDrag(guiElement, input, delta)
-- do nothing...
end
-- apply it to track touch control input
local draggedItems = {};
if (control.touchGui) then
for _, child in next, control.touchControlFrame:GetChildren() do
draggedItems[#draggedItems+1] = dragger.new(child);
end
control.touchControlFrame.ChildAdded:Connect(function(child)
draggedItems[#draggedItems+1] = dragger.new(child);
end)
end
local function isInteracting()
for i = 1, #draggedItems do
if (draggedItems[i].isDragging) then
return true;
end
end
return false;
end
game:GetService("RunService").RenderStepped:Connect(function(dt)
print(isInteracting());
end)
thanks , this helped me out a lot i am not sure if i should mark your post as the solution since I’ve already marked @Fm_Trick s post as solution but ill mark it any way