removeShape method

Body removeShape(
  1. Shape shape
)

Remove a shape from the body. @return The body object, for chainability.

Implementation

Body removeShape(Shape shape){
  final index = shapes.indexOf(shape);

  if (index == -1) {
    logger?.warning('Shape does not belong to the body');
    return this;
  }

  shapes.removeAt(index);
  shapeOffsets.removeAt(index);
  shapeOrientations.removeAt(index);
  updateMassProperties();
  updateBoundingRadius();

  aabbNeedsUpdate = true;

  shape.body = null;

  return this;
}