colliders static method

void colliders(
  1. Node root, {
  2. Vector4? color,
  3. Vector4? triggerColor,
  4. int segments = 16,
})

Draws the wireframe of every Collider in the root subtree, posed the way the simulation sees it.

Triggers draw in triggerColor so they stand apart from solid volumes.

Implementation

static void colliders(
  Node root, {
  vm.Vector4? color,
  vm.Vector4? triggerColor,
  int segments = 16,
}) {
  final solid = color ?? vm.Vector4(0.2, 1.0, 0.4, 0.9);
  final trigger = triggerColor ?? vm.Vector4(1.0, 0.85, 0.2, 0.9);

  for (final collider in root.getComponents<Collider>()) {
    shape(
      collider.shape,
      root.globalTransform.multiplied(collider.localPose),
      color: collider.isTrigger ? trigger : solid,
      segments: segments,
    );
  }
  for (final child in root.children) {
    colliders(child, color: solid, triggerColor: trigger, segments: segments);
  }
}