绘制墙壁时使夹具(形状)透明

Make fixture(shape) transparent when drawing walls

createBoundaries 中使用的示例中,我看到了如何创建“Walls”/EdgeShape。

移动相机时我画了线。你知道如何不画这些线或使它们透明 - 看过 FixtureDef?

import 'package:flame_forge2d/flame_forge2d.dart';

class Wall extends BodyComponent {
  final Vector2 start;
  final Vector2 end;

  Wall(this.start, this.end);

  @override
  Body createBody() {
    final shape = EdgeShape()..set(start, end);

    final fixtureDef = FixtureDef(shape)
      ..restitution = 0.0
      ..friction = 0.3;

    final bodyDef = BodyDef()
      ..userData = this // To be able to determine object in collision
      ..position = Vector2.zero()
      ..type = BodyType.static;

    return world.createBody(bodyDef)..createFixture(fixtureDef);
  }
}

BodyComponent 中设置 renderBody = false 或覆盖 render 为空,在本例中为 Wall