Hi all,
Not sure if I’m missing something but when 3D Touch is used with multitouch, event.pressure on one event.id affects other touches. Try the following code and press with different pressures while moving around:
[lua]
system.activate(“multitouch”)
display.setDefault(“background”, 0)
local touchPts = {}
local radius = display.safeActualContentWidth/10
local n = 0
local function onTouch(event)
local id = event.id
local p = event.phase
local pressure = event.pressure
if p==“began” then
local c = display.newCircle(event.x, event.y, radius)
c:setFillColor(1,0,0)
touchPts[id] = c
n = n + 1
elseif p==“moved” then
local c = touchPts[id]
if pressure~=nil then c.xScale, c.yScale = pressure, pressure end
c.x, c.y = event.x, event.y
c:setFillColor(0,1,0)
elseif p==“ended” or p==“cancelled” then
display.remove(touchPts[id])
touchPts[id] = nil
n = n - 1
end
end
Runtime:addEventListener( “touch”, onTouch )
[/lua]
Is there a way to get different pressures for different touches so they don’t affect each other?
Thanks for your help,
David