Multitouch drag has response lag?

Multitouch drag has a response lag; can it be fixed? I want to create a two person iPad arcade game somewhat like “Air Hockey”. I built a test using the “main_drag_only.lua” file from the “Multitouch Fingers” sample application. But both the test app and Air Hockey suffer from a lag in response time to quick finger drags. Is there a way to eliminate this problem, or is this something I have to live with due to slow graphics processing?
[import]uid: 23636 topic_id: 11947 reply_id: 311947[/import]

i think you are seeing physics at work.
try disabling multitouch and ser if its any better. i’m guessing your paddles are heavy, and thus slowly attain speed.
[import]uid: 34945 topic_id: 11947 reply_id: 43575[/import]

There is no physics involved. I’m using the “main_drag_only.lua” file unchanged straight from the Corona sample app. It’s just touch and move events on a couple of rounded rectangles (no paddles). I did try it with multitouch disabled, and the lag is still there.

[import]uid: 23636 topic_id: 11947 reply_id: 43576[/import]

sorry, thought you were using the airhockey code :slight_smile:
are you having the problem on device or just sim? [import]uid: 34945 topic_id: 11947 reply_id: 43590[/import]

When doing a fast horizontal drag, I can see a lag on both the sim and the device (more so on the device). My belief is that it is because of the processing needed to move the image for each separate move event. So I had the idea to just do the image move at every frame entry point, assuming that would reduce the processing load. I tried that using the code below, and it seems to help a little.

[code]
system.activate( “multitouch” )

local enterFrameCount = 0

local arguments =
{
{ x=150, y=110, w=100, h=25, r=10, red=255, green=0, blue=128 },
{ x=190, y=350, w=100, h=25, r=10, red=255, green=255, blue=0 }
}
local item
item = arguments[1]
local button1 = display.newRoundedRect( item.x, item.y, item.w, item.h, item.r )
button1:setFillColor( item.red, item.green, item.blue )
button1.strokeWidth = 3
button1:setStrokeColor( 200,200,200,255 )
button1.xx = item.x --initialize next position

item = arguments[2]
local button2 = display.newRoundedRect( item.x, item.y, item.w, item.h, item.r )
button2:setFillColor( item.red, item.green, item.blue )
button2.strokeWidth = 3
button2:setStrokeColor( 200,200,200,255 )
button2.xx = item.x --initialize next position

local function moveObjects(event)
–Use the pending next X position to move the button horizontally
button1.x = button1.xx
button2.x = button2.xx
end

local function onTouch( event )
local t = event.target
local phase = event.phase
if “began” == phase then
if enterFrameCount == 0 then
Runtime:addEventListener( “enterFrame”, moveObjects )
end
enterFrameCount = enterFrameCount + 1
display.getCurrentStage():setFocus( t, event.id )
t.isFocus = true
t.x0 = event.x - t.x --Store initial touch offset

elseif t.isFocus then
if “moved” == phase then
– Make object move (we subtract t.x0,t.y0 so that moves are
– relative to initial grab point, rather than object “snapping”).
t.xx = event.x - t.x0 --update the pending next X position

elseif “ended” == phase or “cancelled” == phase then
display.getCurrentStage():setFocus( t, nil )
t.isFocus = false
enterFrameCount = enterFrameCount - 1
if enterFrameCount == 0 then
Runtime:removeEventListener( “enterFrame”, moveObjects )
end
end
end
return true
end

button1:addEventListener( “touch”, onTouch )
button2:addEventListener( “touch”, onTouch )

[/code] [import]uid: 23636 topic_id: 11947 reply_id: 43659[/import]