Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Can you explain me the touch.id

edited September 2014 in General Posts: 12

Hi,
I'm back to codea after a long time. I'm trying to understand touches for coding some gestures.
Can you explain me why the touches table is always empty and the touchesTable is filling of touch?

Thanks

-- Touch

-- Use this function to perform your initial setup
function setup()
    touches={}
    touchesTable={}
    parameter.watch("#touches")
    parameter.watch("#touchesTable")
    t=0
end

-- This function gets called once every frame
function touched(touch)
    if touch.state==BEGAN then
        touches[touch.id]=touch
        t = t + 1
        touchesTable[t]=touch
    end

end

Comments

  • Jmv38Jmv38 Mod
    edited September 2014 Posts: 3,295

    #myTable give the number of indexes starting at 1, increasing 1 by 1 until the first integer missing . So with index like touch.id, that are big numbers, you always get 0.

  • Thank you Jmv38.

Sign In or Register to comment.