I want to make it possible to draw a physical line like here: enter image description here
But I don't know how to make a dynamic line in flume forge2d.
I tried to make ChainShape(), but it can't be BodyType.dynamic. So I tried to make a PolygonShape(), but it can only be convex. So I tried to make a lot of CircleShape() and connect them with a hard link between them And this is what I got
final bodyDef = BodyDef(
userData: this,
position: Vector2(worldSize.x / 2, 5.0),
type: BodyType.dynamic,
);
final shape = CircleShape()..radius = .05;
final fixtureDef = FixtureDef(shape)
..density = 1.1
..friction = 0.5
..filter = filter
..restitution = 0.0;
return world.createBody(bodyDef)
..createFixture(fixtureDef)
..angularVelocity = radians(0);
final List<Ball> balls = [];
final double initialX = 1.5;
final double initialY = 4;
final double spacing = 0.02;
double x = initialX;
double y = initialY;
for (int i = 0; i < 50; i++) {
final ball = Ball();
balls.add(ball);
await world.add(ball);
ball.body.setType(BodyType.dynamic);
if (i > 20){
y = initialY - (i - 20) * spacing;
} else {
x = initialX + i * spacing;
}
ball.body.setTransform(Vector2(x, y), 0);
}
for (int i = 0; i < balls.length - 1; i++) {
final weldJointDef = WeldJointDef()
..initialize(balls[i].body, balls[i + 1].body, balls[i].position)
..dampingRatio = 0
..frequencyHz = 0
..collideConnected = false;
world.createJoint(WeldJoint(weldJointDef));
}
enter image description here But that's not what I need. it's like a jelly-like compound
Сould you please guide me on how can I make a line that has dynamic properties?