hi…,
i have an object with this physics:
physics.addBody(rat1,"dynamic", {density=1.0, friction=0.1, bounce=0.5, radius=25})
…
and i have a collision function …and it works well
function onHit(e)
if(e.phase == "began") then
if(e.object1.type == "stone" and e.object2.type == "rat") then
x=e.object2.x
y=e.object2.y
Runtime:removeEventListener("enterFrame", moveRat)
transition.to(rat1, {time=100, alpha=0})
rat1.bodyType="static"
rat1:removeSelf()
local sheet2 = sprite.newSpriteSheet( "Objects/ex.png", 100, 100)
local spriteSet2 = sprite.newSpriteSet(sheet2, 1, 24)
ratboom = sprite.newSprite( spriteSet2 )
ratboom.timeScale = 0.35
ratboom.x=x
ratboom.y=y
ratboom:play()
transition.to(ratboom, {time=1000, alpha=0})
stoneBoom()
end
end
end
Runtime:addEventListener("collision", onHit)
the problem is when i erase the previous physics line, and use the following physics instead:
squareShape ={ -20,-10, 20,-10, 20,10, -20,10 }
physics.addBody(rat1,"dynamic", {density=1.0, friction=0.1, bounce=0.5, shape=squareShape})
physics.setDrawMode( "hybrid" )
the body is created but the collision listener doesn’t work … However the collision is detected and the other objects are affected through ‘bouncing’ when a hit between them and this object happened !!
…
i don’t know why it only works when using radius !! [import]uid: 96659 topic_id: 18764 reply_id: 318764[/import]
[import]uid: 52491 topic_id: 18764 reply_id: 72392[/import]