+3 votes

I'm trying to detect multitouch for a maximum of two touches simultaneously.
My problem is I can't even detect a touch. I've tried this code sample to test if it works

func _input(event):
    if event is InputEventScreenTouch and event.is_pressed():
        $Label.text = event.position

... and compiles but doesn't work (I tested it on a mobile device, of course).
I know this has been asked many times, but never for Godot 3.0 and I've got no idea how to use the InputEventScreenTouch class.
Also, is there another way to detect multitouch?

in Engine by (570 points)

1 Answer

0 votes

Okay, regarding the Label not printing, that's because I didn't cast its argument into a String, so

`$Label.text = String(event.position)`

displays the event's potition correctly.

Also, I've done some testing and it appears that only InputEventScreenTouch and InputEventScreenDrag are capable of detecting multitouch.

This is not much, but I hope it'll help someone.

by (570 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.