Multitouch gives very unreliable start/stops (DEF-2024) (SOLVED)

I’ve started trying out multitouch and I want to register all touches in a table to keep track of them.
It seems it’s harder than I thought as pressed = true isn’t fired for every touch.
As it is fired sometimes (sometimes on first touch, sometimes only on second and third touch) it really seems like a bug.
Cant use the action.pressed as well as it is only fired at start of a full multitouch session.

This is definitely a blocker for us.

1 Like

Tried to create a workaround using only released to keep track of counts in a table myself.
It turns out that it has flaws as well and touches can be removed from action.touch without sending a last message with released = true before being removed. This makes it impossible to track touches as far as I can see.

2 Likes

There’s a bug reported for this: DEF-2024 (and I’ve verified it myself).

3 Likes

I really tried creating a workaround to avoid this blocker.
Last attempt was to check the delta on each input to track registered touches but it seems to fully skip sending a few messages so the delta is also broken. I just need to give up on this one.
Any estimate on this one being fixed?

Yeah I tried this as well… it’s not an easy beast to tame, the input system ;D

True, but I would say it’s pretty much a core feature having working multitouch on a multiplatform engine.
Unfortunately we now have to use other engines while prototyping.

Really? I’ve had no issues with multitouch. I just tried a little test project and pressed/released seem to work fine too.

Though I’m not sure how you would track specific fingers, since the touches are just in order of appearance. I don’t see how that has anything to do with defold though, just a fact of life.

@ross.grams
What device are you testing on. Are you doing it through wifi target or full installed debug build?
Also: If this feature works as it should, you can always check the dx and dy to see how far the touch has traveled since last input. This way you can keep track on which finger is which between the actions.

I now tried this code snippets on iOS and android and it gave me the same problems.

local count = 0

function on_input(self, action_id, action)
	if action_id == TOUCH then
		for i,v in ipairs(action.touch) do
			if v.pressed then count = count + 1 end
			if v.released then count = count - 1 end
		end
		print(count)
	end
end

Count will soon start to become negative values as especially v.pressed isn’t fired every time when multitouching.

I’m testing on a quite old Android device, v 4.4.4. I was trying it over wifi from the editor, but since you mentioned I tried an installed debug build and there was no difference.

You’re right though, I guess I didn’t test it quite enough before, the count is changing. I’m still not convinced it’s an engine bug but it’s definitely questionable. It only seems to happen if you go crazy drumming all your fingers on and off. I’ll test it some more.

Fixed in Defold 1.2.100

1 Like