Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tapping quick does not register as tap. And Pinch/Twist constantly switching to Multiple finger drag. #11

Closed
golddotasksquestions opened this issue Nov 9, 2020 · 9 comments

Comments

@golddotasksquestions
Copy link

This addon looked incredible promising, and I would have loved to use it in my Android projects, but upon first testing it seemed very laggy and buggy.

To test my impression, I added a simple counter to check if all my taps are registered:

extends Node2D

onready var label = $Label
onready var label2 = $Label2


var tap_counter = 0

func _input(event):
	if (event is InputEventMultiScreenDrag or
		event is InputEventSingleScreenDrag or
		event is InputEventScreenPinch or
		event is InputEventScreenTwist or
		event is InputEventSingleScreenTap or
		event is InputEventSingleScreenTouch):
			label.text = event.as_text()
	if event is InputEventMultiScreenDrag:
		label2.text = "Multiple finger drag"
	elif event is InputEventSingleScreenDrag:
		label2.text = "Single finger drag"
	elif event is InputEventScreenPinch:
		label2.text = "Pinch"
	elif event is InputEventScreenTwist:
		label2.text = "Twist"
	elif event is InputEventSingleScreenTap:
		tap_counter +=1
		label2.text = "Single finger tap "+ str(tap_counter)
	elif event is InputEventSingleScreenTouch:
		label2.text = "Single finger touch"

My impression seemed correct since taps after a certain frequency don't register at all any more.
That's very unfortunate, because the features of this addon would be really amazing if they would work.

Pinch and "Twist" also did not seem reliable at all, constantly switching to "Multiple finger drag"

@Federico-Ciuffardi
Copy link
Owner

Federico-Ciuffardi commented Nov 9, 2020

For high frequency taps to work, you need to lower the value of const TOUCH_DELAY_TIME on InputManager.gd, but be careful if it is too low, it might cause some false positives.

You may also consider using InputEventSingleScreenTouch with pressed == true for high frequency taps.

Regarding the reliability of Twist, Pinch and Multiple finger drag, it depends on your use case, what I mean is that when they are triggered it's because you are actually doing that gesture (maybe it's subtle and you're not realizing), this is good for cases where you want a high level of precision, for example if you are using the plugin to control a 2D camera. On the other hand, if you want to avoid mixing gestures because they trigger important events, you must filter the subtle gestures, for this you can define a threshold for each gesture so the action will be filtered if the relative attribute of the gesture is not greater than the defined threshold, for example:

if event is InputEventMultiScreenDrag and event.relative.length() > multiScreenDragThreshold:

instead of:

if event is InputEventMultiScreenDrag:

Modify the threshold of each gesture until you get to filter all the subtle gestures without ignoring the important ones.

Try all that and do not hesitate to tell me how it went, whether it worked or not.
If I was not clear enough with something also tell me.

Thank you for trying the addon and giving me feedback!

@golddotasksquestions
Copy link
Author

Thank you for the fast and detailed response, I will try all that!

@Federico-Ciuffardi Federico-Ciuffardi changed the title Tabbing quick does not register as tab at all Tapping quick does not register as tab at all Nov 9, 2020
@Federico-Ciuffardi Federico-Ciuffardi changed the title Tapping quick does not register as tab at all Tapping quick does not register as tap at all Nov 9, 2020
@Federico-Ciuffardi Federico-Ciuffardi changed the title Tapping quick does not register as tap at all Tapping quick does not register as tap Nov 9, 2020
@Federico-Ciuffardi Federico-Ciuffardi changed the title Tapping quick does not register as tap Tapping quick does not register as tap. And Pinch and Twist also constantly switching to Multiple finger drag. Nov 9, 2020
@Federico-Ciuffardi Federico-Ciuffardi changed the title Tapping quick does not register as tap. And Pinch and Twist also constantly switching to Multiple finger drag. Tapping quick does not register as tap. And Pinch/Twist constantly switching to Multiple finger drag. Nov 9, 2020
@Federico-Ciuffardi Federico-Ciuffardi transferred this issue from Federico-Ciuffardi/GodotTouchInputManager-Demo Nov 9, 2020
@golddotasksquestions
Copy link
Author

golddotasksquestions commented Nov 9, 2020

Lowering const TOUCH_DELAY_TIME did not help. I tried 0.01 but then no tabs are registered at all. with 0.1 only some taps are registered. with 0.05 almost no taps are registered, it feels very unreliable whatever TOUCH_DELAY_TIME setting I choose.

I could not figure out what you mean with: "You may also consider using ʻInputEventSingleScreenTouchwithpressed = true` for high frequency taps."
Where would I be using that? What means "using" in this case?

@Federico-Ciuffardi
Copy link
Owner

Ok, maybe some work could be done on the tap event support high frequency taps. Actually, when I implemented the tap event, I didn't think about fast taps.

Either way I advice you to try the alternative I proposed. What I meant was "You may also consider using InputEventSingleScreenTouch with pressed == true for high frequency taps".
In this case using means to do something like this:

if event is InputEventSingleScreenTouch and event.pressed:

instead of this:

if event is InputEventSingleScreenTap:

Please try that and let me know if it worked.

And did setting thresholds solve your problems with Pinch and Twist?

@harry-peirse
Copy link

Hi! I'm trying out this plugin and finding it incredibly useful. I am finding that the default 200 millisecond delay for tap events makes the game feel quite unresponsive as the delay between the tap and the action is recognisable, but when I shorten it there's a risk of not capturing the taps of course. I'm going to play around with InputEventSingleScreenTouch to see if that can improve things, but I just wanted to comment here as well so you're aware there's some needs not covered. If I find a nice solution I'll post it and potentially look into a merge request if you're interested.
Thanks for a great plugin!

@Federico-Ciuffardi
Copy link
Owner

Hi @harry-peirse, your comment on the delay made me think about how and when I was detecting a tap, and also what the definition of tap is.

I just changed the implementation (on this branch) so that instead of waiting for the end of the timer, it waits at most for that time, and if it detects that the touch is released before a the timer end a tap event is emitted.

This solves both the delay you mentioned and the detection of fast taps that @golddotasksquestions mentioned.

I wonder if it is correct to have a time limit for the detection of a tap. Perhaps it is better to remove the time limit and add a check that the press and release position do not differ by more than a certain threshold.

Please check if the new implementation suits your needs and tell me your opinion on what I talk about in the paragraph, if you can.

Thanks!

@harry-peirse
Copy link

Hey, thanks a lot for doing that so quickly - it works great!
I think it's good to have the threshold (configurable ideally) as you may want to recognise a hold without moving separately from a tap. The idea of a separate threshold for position differences would be nice for separating a hold event from drag however. Holding to bring up a context menu is a good use case (one I have actually)

@Federico-Ciuffardi
Copy link
Owner

Thank you for your feedback! I will merge the changes soon and release a new version.

@golddotasksquestions
Copy link
Author

golddotasksquestions commented Dec 29, 2020

Personally I would expect the same behaviour as Input static class:

tab = Input.is_action_just pressed() <-- no delay, no timer
tab_hold = Input.is_action_pressed()
tab_released = Input.is_action_just_released()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants