How do I allow player to aim with 2 fingers on mobile?

For example, on the game Rivals, if you hold your finger on the shoot button, you can use that finger to aim while shooting, OR you can also use a second finger to aim while holding the shoot button with your first finger.

I have already tried to implement this by setting the Active property of the GuiButton to false, but when I try to aim with another finger, it does not let me move my camera. I believe this is because roblox detects it as being a pinch to zoom in/out and when you are zooming in/out on mobile, you cannot move your camera up/down/left/right.

Also when the Active property of the GuiButton is true, it allows me to aim with my second finger but not my first (the one pressing the shoot button) because when Active is true, the button becomes an input sink.

I have looked on other posts but haven’t been able to find a solution to this. Any help would be appreciated!

1 Like

Yo I am trying to implement the same exact thing in my game and you’re the only post I’ve seen talking about it. I haven’t found any other FPS games aside from Rivals which allow you to shoot and move the camera with two fingers, so it could be that their developers rewrote the camera module to allow for it or made edits to the default roblox one. There might be some line of code in the default camera module that you could delete to disable the pinching inputs, though thats unideal. I really hope someone else has an easier solution than that because this is such an annoying feature not to have in a mobile fps.

Yeah I was looking into disabling pinching inputs I’m still not sure how to disable that. I tried finding any posts about it, but I couldn’t find any. But yes, disabling pinching is also not ideal because there are times in my game where you should be able to zoom out (unless there is a convenient way to disable/enable it). Also, you might be right about Rivals rewriting the camera module. I have not seen any other FPS game handle it the same way.

Yo! I was able to figure it out by reading through the CameraModule made by Roblox. Here are the steps that I took to achieve this:

  1. Open Studio (in a new experience) and run a test session
  2. Go to StarterPlayer > StarterPlayerScripts
  3. Copy the PlayerScriptsLoader LocalScript and the PlayerModule ModuleScript
  4. Exit test mode
  5. Paste the scripts into StarterPlayer > StarterPlayerScripts
  6. Go to PlayerModule > CameraModule > CameraInput
  7. Search for this line: if #unsunkTouches == 1 then (mine is on line 352)
  8. Replace it with if #unsunkTouches >= 1 then
  9. And done!

The only issue with this is that if you use third person view, mobile players are able to pan their camera while pinch zooming. I added some extra variables so that I can freely enable/disable this when needed.

Edit: This does not disable the pinch functionality, but it allows mobile players to use more than 1 finger to aim when locked in first person

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.