Strand
A rope or a chain made by PhysicsWorld.rope or PhysicsWorld.chain: its particles in order from one end to the other, the links between neighbours, and the bends at every particle but the ends (empty when it has none). They are ordinary world particles and constraints; this just remembers which ones.
toString gives how many of each it has, for example Strand(particles=11, links=10, bends=9).
Samples
val world = PhysicsWorld()
val rope = world.rope(fromX = 0f, fromY = 0f, toX = 100f, toY = 0f, segments = 10)
assertPrints(rope, "Strand(particles=11, links=10, bends=0)")
// Its start is pinned where it was made; the rest falls and hangs.
assertPrints(world.particles.inverseMassOf(rope.first), "0.0")
assertPrints(rope.restLength(world), "100.0")Content copied to clipboard
Functions
Link copied to clipboard
Returns how long this strand is at rest in world: the sum of its links' rest lengths.