HTML5 multitouch on mobile

I’m trying to use multitouch on HTML5 on mobile, but for some reason only the first tap triggers. I started stripping down the code and have ended up with:

function init(self)

	msg.post("#", "acquire_input_focus")
	
end

function on_input(self, action_id, action)

	if action.pressed then

		local game_object = factory.create("/main#touch_factory")
		go.set_position(vmath.vector3(action.x, action.y, 0), game_object)
		
		local position_label = msg.url(nil, game_object, "position")
		local text = ""
		for k,v in pairs(action) do
			text = text .. k .. " = " .. tostring(v) .. "\n"
		end
		label.set_text(position_label, text)

	end

end

When bundled as HTML5, the first tap works. When tapping and holding, any following taps are ignored, until I’ve released the finger and tap again. I’m using /builtins/input/all.input_binding.

Am I missing something basic here?

Defold 1.9.7.

Minimal repro:
html5_test.zip (3.1 KB)

This is how multitouch worked. You need to check array action.touch

5 Likes

We’re in business! Thanks!

1 Like