updateAABB method

void updateAABB()

Updates the .aabb

Implementation

void updateAABB(){
  final shapes = this.shapes;
  final shapeOffsets = this.shapeOffsets;
  final shapeOrientations = this.shapeOrientations;
  final N = shapes.length;
  final offset = _tmpVec;
  final orientation = _tmpQuat;
  final bodyQuat = quaternion;
  final aabb = this.aabb;
  final shapeAABB = _updateShapeAABB;

  for (int i = 0; i != N; i++) {
    final shape = shapes[i];

    // Get shape world position
    bodyQuat.vmult(shapeOffsets[i], offset);
    offset.vadd(position, offset);

    // Get shape world quaternion
    bodyQuat.mult(shapeOrientations[i], orientation);

    // Get shape AABB
    shape.calculateWorldAABB(offset, orientation, shapeAABB.lowerBound, shapeAABB.upperBound);

    if (i == 0) {
      aabb.copy(shapeAABB);
    } else {
      aabb.extend(shapeAABB);
    }
  }

  aabbNeedsUpdate = false;
}