Collision doesn't working when button is pushed

Hi, everyone!

I have problem with collision in touch event for static and dynamic objects. Everything works if button to move dynamic object is not pushed. But if  I’m holding move button and dynamic object contatcs static object collision doesn’t work.

Thanks for fast answer :slight_smile:

No ideas guys ?:frowning:

How are you moving the object?

up:addEventListener('touch', movePlayer) left:addEventListener('touch', movePlayer) right:addEventListener('touch', movePlayer) THEN function movePlayer(e) if(e.phase == 'began' and e.target.name == 'up') then dir = 'up' rocket.isAwake = true elseif(e.phase == 'ended' and e.target.name == 'up') then dir = 'none' elseif(e.phase == 'began' and e.target.name == 'left') then dir = 'left' rocket.isAwake = true elseif(e.phase == 'began' and e.target.name == 'right') then dir = 'right' rocket.isAwake = true elseif(e.phase == 'ended' and e.target.name == 'left') then dir = 'none' elseif(e.phase == 'ended' and e.target.name == 'right') then dir = 'none' end end THEN function update(e) if(dir == 'up') then hitMoon = false hitWall = false rocket:setLinearVelocity(0, -150) elseif(dir == 'left') then hitMoon = false hitWall = false rocket:setLinearVelocity(-125, 40) elseif(dir == 'right') then hitMoon = false hitWall = false rocket:setLinearVelocity(125, 40) end

No ideas guys ?:frowning:

How are you moving the object?

up:addEventListener('touch', movePlayer) left:addEventListener('touch', movePlayer) right:addEventListener('touch', movePlayer) THEN function movePlayer(e) if(e.phase == 'began' and e.target.name == 'up') then dir = 'up' rocket.isAwake = true elseif(e.phase == 'ended' and e.target.name == 'up') then dir = 'none' elseif(e.phase == 'began' and e.target.name == 'left') then dir = 'left' rocket.isAwake = true elseif(e.phase == 'began' and e.target.name == 'right') then dir = 'right' rocket.isAwake = true elseif(e.phase == 'ended' and e.target.name == 'left') then dir = 'none' elseif(e.phase == 'ended' and e.target.name == 'right') then dir = 'none' end end THEN function update(e) if(dir == 'up') then hitMoon = false hitWall = false rocket:setLinearVelocity(0, -150) elseif(dir == 'left') then hitMoon = false hitWall = false rocket:setLinearVelocity(-125, 40) elseif(dir == 'right') then hitMoon = false hitWall = false rocket:setLinearVelocity(125, 40) end