How can I go about checking where the player taps the screen on mobile?
I’d like their automatic weapons to only fire when they are touching the right-side of the screen, not the left (touch pad area).
How can I go about checking where the player taps the screen on mobile?
I’d like their automatic weapons to only fire when they are touching the right-side of the screen, not the left (touch pad area).
This passes the position(s) as parameter 1, it comes in an array as it supports gestures/multiple touch positions.
Thanks, but TouchTap only fires if you quickly tap the screen - it isn’t registered if you hold down your finger on the screen, as you would for automatics.
I’ve tried TouchLongPress too but this fires far too late, and doesn’t fire at all if the player slightly drags their finger.
You could try utilizing UserInputService.InputBegan(InputObject). Check if InputObject.UserInputType == Enum.UserInputType.Touch
If it does, you can get the position by doing InputObject.Position, it’s a Vector3 but just use the X,Y values as if it were a Vector2.
You should use TouchStarted and TouchEnded. The first returned object is a InputObject which contains touch Position in pixels.
I suppose there’s also those events!
This works thanks. I’ve simplified this even more and use ‘gameProcessedEvent’ to check if the player is touching a UI (like the touch pad) or not.