Hi,
I created a chain by attaching squares with pivot joints, it is working as expected when the chain is attached to a static base.
But when i attach the chain to a falling base and suddenly stop a the falling base the chain attached to the base doesnt stop along with the base, the chain keeps extending like an elastic rope. how can i have a chain which acts like a solid rope without any elasticity.
please use the test case to better understand my problem
local physics = require( “physics” )
physics.start()
physics.setDrawMode(“hybrid”)
– physics.setContinuous( false )
physics.setVelocityIterations( 16 )
local function make_chain( x, y, w, h, c )
for i = 1, c do
local link = display.newRect( 0,0,w, h )
link.x,link.y = x, y+(i*(h+1))
link:toBack( )
if (i == 1) then
firstChain = link
end
physics.addBody( link, “dynamic”, { friction=0, bounce=0 ,isSensor = true, density = 0 } )
link.gravityScale = 0
if i > 1 then
print( i )
physics.newJoint( “pivot”, prev_link, link, x, prev_link.y + (h*.5) )
end
prev_link = link
end
end
make_chain( display.contentCenterX, -display.contentHeight, 20, 20, display.contentHeight/20 )
local dummyCeiling = display.newRect( display.contentCenterX, firstChain.y, display.contentWidth, 40 )
dummyCeiling.y = firstChain.y
physics.addBody( dummyCeiling, “dynamic”, { friction=0, bounce=0 ,isSensor = true, density = 0 } )
physics.newJoint( “pivot”, firstChain, dummyCeiling, firstChain.x, firstChain.y )
function enterFrame( event )
if (dummyCeiling.y > 30) then
dummyCeiling.y = 30
end
end
Runtime:addEventListener(“enterFrame”, enterFrame)