setTear
Makes link break once it is stretched past stretch times its rest length, at the end of a step; 0 never breaks it. A bend across the two particles it joined breaks with it, so a torn rope or cloth comes apart cleanly instead of hanging on by its bends.
Throws
if stretch is neither 0 nor more than 1.
Samples
val world = PhysicsWorld()
val anchor = world.particles.add(x = 0f, y = 0f, mass = Particles.STATIC)
val weight = world.particles.add(x = 0f, y = 10f, mass = 50f)
val thread = world.constraints.distance(anchor, weight, compliance = 0.01f)
// Breaks once stretched past one and a half times its rest length.
world.constraints.setTear(thread, 1.5f)
repeat(60) { world.step(1.seconds / 60) }
assertPrints(world.constraints.isAlive(thread), "false")
assertPrints(world.constraints.tornCount, "1")Content copied to clipboard