Why does obj2 bounce (turning a small square) as if obj1 still exists?
display.setStatusBar( display.HiddenStatusBar ) display.setDefault( "background", 1,1,1 ) require("physics") local widget = require( "widget" ) physics.start() physics.setGravity(0,10) local shape1={-150,-180, 150,-180, 150,180, -150,180} local shape2={-220,-10, 220,-10, 220,10, -220,10} local shape3={-10,-10, 10,-10, 10,10, -10,10} --small rectangle local obj1=display.newPolygon( 375,300 , shape1 ) -- bouncing effect --local obj1=display.newPolygon( 455,165 , shape2 ) -- no bouncing effect local obj2=display.newPolygon( 355,155 , shape2 ) local obj3=display.newPolygon( 134,129 , shape3 ) obj1.fill = {0,1,0,.5} obj2.fill = {0,1,0,.5} obj3.fill = {0,1,0,.5} local function cut( event ) if ( "ended" == event.phase ) then physics.addBody( obj1) obj1:removeSelf() -- delete from memory obj1 physics.addBody( obj2 ) -- the rectangle behaves as if obj1 still exists physics.addBody( obj3 ) -- the square rotates from contact with the obj2 end end local button1 = widget.newButton( { fontSize=29, left = 10, top = 10, id = "button1", label = "start", onEvent = cut } )