The question is in the comments to the code.
local physics = require('physics') physics.start() physics.setGravity( 0, 0 ) physics.setDrawMode( "hybrid" ) local c1 = display.newRect( 100, 200, 40,40 ) local c2 = display.newRect( 100,400, 40, 400 ) c2.fill = {1,0,0} physics.addBody( c1) physics.addBody( c2) physics.newJoint( "pivot", c1,c2,100, 210 ) -- Objects have the same x coordinate (x = 100) -- Joint exactly in the middle of objects timer.performWithDelay( 1000,function() physics.setGravity( 0, 5 ) local static = display.newRect( 100, 400, 40, 40) physics.addBody( static, "static") end ) --Now the top cube is a little to the right of the stick. Why? Did the coordinates of the joint change? --I understand that this is due to a collision with a static object. --This means you can’t create a new body if during creation it intersects with others?