Here’s code that I posted in another discussion. I added code to destroy one of the joints when you do a double tap. Just run the program and when you’re ready, double tap the screen.

EDIT1: Changed and reposted the program.

EDIT2: Changed the program again to keep the line and joint circle after breaking the joint.

EDIT3: Changed the program again for a more realistic joint break.

```
supportedOrientations(PORTRAIT)
displayMode(FULLSCREEN)
function setup()
dest=false
c1 = physics.body(CIRCLE,0)
c1.x = 400
c1.y = 1000
c1.type = STATIC
c2 = physics.body(CIRCLE,25)
c2.x = 200
c2.y = 900
c2.sensor=true
c3 = physics.body(CIRCLE, 25)
c3.x = 500
c3.y = 950
c3.sensor=true
c4 = physics.body(CIRCLE, 25)
c4.x = 300
c4.y = 850
c4.sensor=true
p1=physics.body(POLYGON,vec2(-10,25),vec2(-10,-25),vec2(10,-25),vec2(10,25))
p1.x=400
p1.y=850
p1.sensor=true
joint1 = physics.joint(REVOLUTE,c1,c2,c1.position)
joint2 = physics.joint(REVOLUTE, c2, c3,vec2(c2.x,c2.y))
joint3 = physics.joint(REVOLUTE, c3, c4,vec2(c3.x,c3.y))
joint4 = physics.joint(REVOLUTE, c4, p1,vec2(c4.x,c4.y))
end
function draw()
background(40, 40, 50)
fill(255)
strokeWidth(2)
line(c1.x,c1.y,c2.x,c2.y)
line(c2.x,c2.y,c3.x,c3.y)
if not dest then
line(c3.x,c3.y,c4.x,c4.y)
else
line(c5.x,c5.y,c4.x,c4.y)
ellipse(c5.x,c5.y,8)
end
line(c4.x,c4.y,p1.x,p1.y)
ellipse(c1.x,c1.y,8)
ellipse(c2.x,c2.y,8)
ellipse(c3.x,c3.y,8)
ellipse(c4.x,c4.y,8)
translate(p1.x,p1.y)
rotate(p1.angle)
points = p1.points
for j = 1,#points do
a = points[j]
b = points[(j % #points)+1]
line(a.x, a.y, b.x, b.y)
end
end
function touched(t)
if t.state==BEGAN and t.tapCount==2 then
dest=true
c5=physics.body(CIRCLE,25)
c5.x=c3.x
c5.y=c3.y
c5.linearVelocity=c3.linearVelocity
joint5 = physics.joint(REVOLUTE, c5, c4,vec2(c5.x,c5.y))
joint3:destroy()
end
end
```