updateBoundingRadius method

void updateBoundingRadius()

Update the bounding radius of the body. Should be done if any of the shapes are changed.

Implementation

void updateBoundingRadius(){
  final shapes = this.shapes;
  final shapeOffsets = this.shapeOffsets;
  final N = shapes.length;
  double radius = 0;

  for (int i = 0; i != N; i++) {
    final shape = shapes[i];
    shape.updateBoundingSphereRadius();
    final offset = shapeOffsets[i].length();
    final r = shape.boundingSphereRadius;
    if (offset + r > radius) {
      radius = offset + r;
    }
  }

  boundingRadius = radius;
}