EndContact has wrong normal?...[SOLVED]
Posted: Tue Sep 06, 2016 1:47 am
I was trying to use contact:getNormal() and it returned some weird results such as x=4.5268153724432e-021, y=0 which is always the result whatever the endcontact callback is called from..I tried to jump, to touch a wall and leave it and the results were quite the same..
here is end contact function:
here is how I set it
does anyone know what's the problem?
thanks!
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!