Mobile camera controls

Just wondering. How do you:

a) Tell if the player dragging their finger is currently moving the camera
b) Temporarily disable the player from moving the camera with dragging

Thanks

Edit: To clarify, I don’t want to completely disable camera movement. I still want it to follow (and track) the player. I just want the dragging movement temporarily disabled. Do we currently have this functionality?

6 Likes

From what I could figure out, having an invisible frame that covers the whole frame with Active set to true. Problem is you would need to make the DisplayOrder on the ScreenGuis not be 0, or just make sure you create that frame before anything else that takes touch inputs, like the mobile controllers.

For telling a player is currently moving the camera, all I could find was detecting is the player is touching the screen using InputBegan and InputEnded and check if the first input is not over an active GUI.

3 Likes

There are multiple events that UserInputService has that may be useful:

  1. TouchSwipe
    Fires when swiping multiple fingers, or just one.
  2. TouchPan
    This one fires when you drag at least one finger.
  3. TouchMoved
    This one just fires when the finger is moved.

Instead of using InputBegan and InputEnded, I’d use one of these along with the invisible frame. Or instead of the invisible frame I’d change some settings in the Camera script but I’d have to get back to you in a bit.