Bullet bodies tunnel through dynamic bodies

Hi!

Basically I’ve run into this: bodies with high velocity sometimes pass through other bodies.

I’ve researched on the subject and found this great explanation:
http://stackoverflow.com/a/8308118

It’s said there that Box2D uses Continuous Collision Detection between dynamic and static objects to solve this problem. And if you want such behavior between dynamic bodies body.isBullet must be set to true.

I’ve found that it really works with static bodies. However with dynamic bodies tunneling still occurs. It’s like CCD still won’t turn on for them.
Example that illustrates the issue:

local physics = require "physics"  
physics.start();  
  
physics.setDrawMode("hybrid")  
physics.setScale( 60 )  
physics.setGravity( 0, 0 )  
  
--these won't help  
physics.setPositionIterations( 16 )  
physics.setVelocityIterations( 8 )  
  
local screenW, screenH, halfW = display.contentWidth, display.contentHeight, display.contentWidth\*0.5  
local circleR=30  
local circleLinearDamping=5  
local puckPhysicsProp = {density=1, friction=.2, bounce=0.5, radius=circleR}  
  
local function circleTouched(event)  
  
 local target = event.target  
  
 if event.phase== "began" then   
  
 target:applyLinearImpulse(-276, -163, target.x, target.y)  
  
 end  
end  
  
targetCircle = display.newCircle(300, 200, circleR)  
targetCircle:setFillColor(128)  
bulletCircle = display.newCircle(350, 270, circleR)  
  
physics.addBody(targetCircle, "dynamic", puckPhysicsProp)  
physics.addBody(bulletCircle, "dynamic", puckPhysicsProp)  
  
bulletCircle.isBullet = true   
  
targetCircle.isFixedRotation=true  
bulletCircle.isFixedRotation=true  
  
targetCircle.linearDamping=circleLinearDamping  
bulletCircle.linearDamping=circleLinearDamping  
  
targetCircle.isSleepingAllowed=false  
bulletCircle.isSleepingAllowed=false  
bulletCircle:addEventListener("touch", circleTouched)  
  
  
targetCircle2 = display.newCircle(300, 500, circleR)  
targetCircle2:setFillColor(128)  
bulletCircle2 = display.newCircle(350, 570, circleR)  
  
physics.addBody(targetCircle2, "static", puckPhysicsProp)  
physics.addBody(bulletCircle2, "dynamic", puckPhysicsProp)  
  
bulletCircle2.isBullet = true   
  
targetCircle2.isFixedRotation=true  
bulletCircle2.isFixedRotation=true  
  
targetCircle2.linearDamping=circleLinearDamping  
bulletCircle2.linearDamping=circleLinearDamping  
  
targetCircle2.isSleepingAllowed=false  
bulletCircle2.isSleepingAllowed=false  
bulletCircle2:addEventListener("touch", circleTouched)  

I’ve submitted it as case #12818. [import]uid: 13989 topic_id: 23269 reply_id: 323269[/import]