Hello, I am seeking a solution for a problem linking objects with joints. In debug mode, it looks like I have my 7 link rope all connected to “empty bucket”, but there seems to be a ton of space between " link[7] " and “emptybucket”. Can someone please help me close the gap so my rope looks taught?
Kind Regards, Jamie
HERE IS MY CODE:
–floor–
local rect = display.newRect( 0, 610, 1024, 600 )
rect:setFillColor( 255, 255, 255, 0 )
physics.addBody( rect, “static”, { density = 1.0, friction = 0.1, bounce = 0.2 } )
–links–
local link2 = display.newImage(“link.png”, 270, 340)
physics.addBody( link2, “static”, { density = 1.0, friction = 0.1 } )
local emptybucket = display.newImage(“emptybucket.png”, 150, 495)
physics.addBody( emptybucket, { density = 3.0, friction = .3, bounce = 0.2 } )
local link = {}
local joint = {}
for j = 1,7 do
link[j] = display.newImage( “link.png” )
link[j].x = 274
link[j].y = 340 + (j*25)
physics.addBody( link[j], {density=1, friction=0.1, bounce=0.2 } )
– create joints between links
if (j > 1) then
prevLink = link[j-1] – each link is joined with the one before it
else
prevLink = link2 – first board is joined to well
end
joint[j] = physics.newJoint( “pivot”, prevLink, link[j], 270, 340 + (j*25) )
end
– join final link to emptybucket
joint[#joint + 1] = physics.newJoint( “pivot”, link[7], emptybucket, 200, 495 )
[import]uid: 10840 topic_id: 30977 reply_id: 330977[/import]