private void recalculateCenter() {
        double massSum = 0.0;
        Vector3f locationSum = new Vector3f();
        Vector3f velocitySum = new Vector3f();
        Vector3f tmpVector = new Vector3f();
        List<PhysicsLink> links = listLinks(PhysicsLink.class);
        for (PhysicsLink link : links) {
            PhysicsRigidBody rigidBody = link.getRigidBody();
            float mass = rigidBody.getMass();
            massSum += mass;

            rigidBody.getPhysicsLocation(tmpVector);
            tmpVector.multLocal(mass);
            locationSum.addLocal(tmpVector);

            link.velocity(tmpVector);
            tmpVector.multLocal(mass);
            velocitySum.addLocal(tmpVector);
        }

        float invMass = (float) (1.0 / massSum);
        locationSum.mult(invMass, centerLocation);
        velocitySum.mult(invMass, centerVelocity);
        ragdollMass = (float) massSum;
    }
Recalculate the total mass of the ragdoll. Also updates the location and
estimated velocity of the center of mass.
jme3-jbullet/src/main/java/com/jme3/bullet/animation/DynamicAnimControl.java