Hi,
I have created a rope as such with rectangles and joints, I then ‘throw’ and object at it.
It seems if I throw it with too much force it simply goes through the rope as if its not there is there any reason for this, my code is below:
[lua]local ropeTop = display.newRect(0,0,10,10)
ropeTop.x = 100
ropeTop.y = 100
physics.addBody( ropeTop, “static”)
local ropeBottom = display.newRect(0,0,10,10)
ropeBottom.x = 200
ropeBottom.y = 400
physics.addBody( ropeBottom, “static”)
local rope = {}
local joint = {}
local prevLink
– Creates a rope between two points
for j = 1,18 do
rope[j] = display.newRect(0,0,5,20)
rope[j].x = ropeTop.x
rope[j].y = ropeTop.y + (j*10)
physics.addBody( rope[j], { density=.7, friction=0.3, bounce=0 } )
– damping the board motion increases the “tension”
rope[j].angularDamping = 5000
rope[j].linearDamping = 1
– create joints
if (j > 1) then
prevLink = rope[j-1]
else
prevLink = ropeTop
end
joint[j] = physics.newJoint( “weld”, prevLink, rope[j],prevLink.x, prevLink.y )
end
– join final rope to bottom
joint[#joint + 1] = physics.newJoint( “weld”, rope[#rope], ropeBottom, rope[#rope].x,rope[#rope].y)[/lua]
Also i’m finding my rope attaches to the ropeTop object but it doesn’t seem to attach to ropeBottom, can anyone see why?
Thanks [import]uid: 72726 topic_id: 14709 reply_id: 314709[/import]
