Mobile Multitouch with TouchScreenButton and dragging

Godot Version

4.4.1

Question

I’m trying to make a simple mobile game, with one player/character that moves horizontally and shoots. To move it I’m using a touch and drag on the screen, not a fixed joystick or buttons. And to shoot, I’m using a TouchScreenButton.

The problem is when I’m dragging on the screen, if I touch the button, the movement stops. Or if I’m touching the button, I cannot move the player.

I would like to make both actions at the same time, independently.

Is it possible somehow?

I’ve made a simple demo project:
https://www.dropbox.com/scl/fi/dkdkp3vsjygltnqz074x3/touchtest.zip?rlkey=tufi8hswfj7phxnore8un8mf7&st=okjyousm&dl=1

Must be tested on real device because of the touch mechanics.

Touch events have an index. You can use this index to identify different touches.

The touch index in the case of a multi-touch event. One index = one finger.

All you have to do is store and check against the stored index to differentiate between the touch and the drag.

Hope that helps.

PS So on drag start, store the index. On dragging, if index is the same as the start of the drag, carry on. If not, check it is not a ‘fire touch’. If that makes sense.