solve() {
    if (
      this.options.gravitationalConstant !== 0 &&
      this.physicsBody.physicsNodeIndices.length > 0
    ) {
      let node;
      const nodes = this.body.nodes;
      const nodeIndices = this.physicsBody.physicsNodeIndices;
      const nodeCount = nodeIndices.length;

      // create the tree
      const barnesHutTree = this._formBarnesHutTree(nodes, nodeIndices);

      // for debugging
      this.barnesHutTree = barnesHutTree;

      // place the nodes one by one recursively
      for (let i = 0; i < nodeCount; i++) {
        node = nodes[nodeIndices[i]];
        if (node.options.mass > 0) {
          // starting with root is irrelevant, it never passes the BarnesHutSolver condition
          this._getForceContributions(barnesHutTree.root, node);
        }
      }
    }
  }
This function calculates the forces the nodes apply on each other based on a gravitational model.
The Barnes Hut method is used to speed up this N-body simulation.
@private