Physics objects passing into each other

I have this physics object declarations:

  
puck = display.newRect( 5, 5, 10, 10)  
puck.strokeWidth = 2  
puck:setFillColor(0, 0, 0)  
puck:setStrokeColor(180, 180, 180)  
physics.addBody( puck, {density=0.8, friction=0.2, bounce=0.5} ) -- linearDamping = 0.3, angularDamping = 0.8, isBullet = true  
puck.linearDamping = 0.3  
puck.angularDamping = 0.8  
puck.isBullet = true -- force continuous collision detection, to stop really fast shots from passing through other balls  
  
top\_boundary = display.newLine(5,5, 475,5)  
left\_boundary = display.newLine(5,5, 5,315)  
bottom\_boundary = display.newLine(5,315, 475,315)  
right\_boundary = display.newLine(475,5, 475,315)  
  
bumperBody = { friction=0.5, bounce=0.5 }  
physics.addBody( top\_boundary, "static", bumperBody )  
physics.addBody( left\_boundary, "static", bumperBody )  
physics.addBody( bottom\_boundary, "static", bumperBody )  
physics.addBody( right\_boundary, "static", bumperBody )  

after applying a strong force to the puck, sometime it pass right into the boundaries, why does this happens? What am I doing wrong?

Thanks [import]uid: 118481 topic_id: 20597 reply_id: 320597[/import]

After googling is setDrawMode to hybrid and I’m seeing that physics boxes are not following the complete shape of the boundaries to be more precise they are exactly half the line, I think I’ll have to manually create a shape, but why is that shouldn’t the addPhysics automatically follow the line since it’s a rectangle? [import]uid: 118481 topic_id: 20597 reply_id: 80825[/import]

I fixed this myself, if anybody read this searching for the same problem, drawLine didn’t work as I expected, it’s better to use drawRect.

[import]uid: 118481 topic_id: 20597 reply_id: 80832[/import]

I’m sorry I didn’t see this sooner, I would have liked to be able to assist you.

That said, well done on solving the problem and sharing your solution with the community :slight_smile:

Peach [import]uid: 52491 topic_id: 20597 reply_id: 81003[/import]