I crate game for android device. I want that my object would move with my finger and rotate when i touch screen with 2 fingers. I understand that when i touch the screen with one finger Defold see my finger with multiple touches and my object start shakes. Question is, how to make all movement and rotation on the screen?
Did you read the documentation on multi touch? There’s even a snippet of code to correctly identify 2+ fingers:
function on_input(self, action_id, action)
if action_id == hash("touch") and #action.touch > 1 and #action.touch < 4 then
-- If there's 2-3 touch point we'll spawn
-- magic spark particles at each point.
for i, tpoint in ipairs(action.touch) do
local pos = vmath.vector3(tpoint.x, tpoint.y, 0)
factory.create("#factory", pos)
end
end
end
1 Like