I’m having problems with the elimination of a very fast physical body.
I have a 30 * 30 ball body that anchored a 36 * 36 circular shield.
At this point I have a very quick bullet that in contact with the shield should eliminate and not touch the ball.
The problem is that it still touches the ball by eliminating it. How can I fix it? I also tried with “.isBodyActive = false” but it does not work. I attach the shield code:
local shield = display.newImageRect( "images/shield.png", 36, 36) shield:translate( ball.x, ball.y ) shield.name = "shield" physics.addBody(shield, "dynamic", {isSensor = true, radius = 18, filter = filterShield} ) shield.isBullet = true shield.joint= physics.newJoint( "pivot", ball, shield, ball.x, ball.y) function shield:preCollision( event ) local phase, other = event.phase, event.other if(other.name == "bullet")then other.isBodyActive = false local t1 = timer.performWithDelay( 2, function() --remove bullet display.remove(other) other = nil --remove shield display.remove(self) self = nil end, 1) end end shield:addEventListener( "preCollision" )