here is end contact function:
Code: Select all
local function endContactFunc(fixa, fixb, contact)
local nx, ny = contact:getNormal()
g.db:log(nx, ny)
local ud1 = fixa:getBody():getUserData()
local ud2 = fixb:getBody():getUserData()
if ud1 then
if fixb:isSensor() then
ud1:onuntriggered(fixb:getBody(), contact, ud2)
else
ud1:onuncollided(fixb:getBody(), contact, ud2)
end
end
if ud2 then
if fixa:isSensor() then
ud2:onuntriggered(fixa:getBody(), contact, ud1)
else
ud2:onuncollided(fixa:getBody(), contact, ud1)
end
end
end
Code: Select all
g.physworld:setCallbacks(beginContactFunc, endContactFunc)
thanks!