Hi there
I have two floating balloons attached with a rope. It’s a semple rope made with pivot joints.
However the joint keeps breaking once the rope collides with a static object and lets the balloons to escape. Please see the attached screenshot.
here is my code:
physics = require( “physics” )
physics.start()
local ropeParts = display.newGroup()
myBg = display.newImage( “bg.png”, 0, 0 )
myObj = display.newImage( “obj.png”, 200, 250 )
myObj2 = display.newImage( “obj.png”, 50, 250 )
obstacle = display.newImage( “obstacle.png”, 50, 100 )
hang = display.newImage( “hang.png”, 120, 270 )
physics.addBody( myObj, { density=2, friction=0.05, bounce=0.01 } )
physics.addBody( myObj2, { density=2, friction=0.05, bounce=0.01 } )
physics.addBody( obstacle, “static”, { friction=0.5, bounce=0.3 } )
physics.addBody( hang, “static”, { friction=0.5, bounce=0.3 } )
local board = {}
local joint = {}
for j = 1,10 do
board[j] = display.newImage( “rope.png” )
board[j].x = 200 - (j*10)
board[j].y = 300
physics.addBody(board[j])
if(j == 1) then
local joint = physics.newJoint(‘pivot’, myObj, board[j], board[j].x+9, board[j].y)
end
if(j > 1) then
local joint = physics.newJoint(‘pivot’, board[j-1], board[j], board[j].x+9, board[j].y)
end
if(j == 10) then
local joint = physics.newJoint(‘pivot’, myObj2, board[j], board[j].x-9, board[j].y)
end
end
myObj.gravityScale = -.25
myObj2.gravityScale = -.25
Any suggesions to make the joints more rigid/solid. ??
Thank you!