MinieLibrary/src/main/java/com/jme3/bullet/animation/RagUtils.java
/**
     * Find the main root joint of an Armature, based on its total mesh weight.
     *
     * @param armature the Armature (not null, unaffected)
     * @param targetMeshes an array of animated meshes to provide weights (not
     * null)
     * @return a root joint, or null if none found
     */
Find the main root joint of an Armature, based on its total mesh weight.

@param armature the Armature (not null, unaffected)
@param targetMeshes an array of animated meshes to provide weights (not
null)
@return a root joint, or null if none found
Find the main root joint of an Armature based on its total mesh weight . @param armature the Armature ( not null unaffected ) @param targetMeshes an array of animated meshes to provide weights ( not null ) @return a root joint or null if none found
static Joint findMainJoint(Armature armature, Mesh[] targetMeshes) {
        Validate.nonNull(targetMeshes, "target meshes");
        Joint[] roots = armature.getRoots();
        Joint result;
        if (roots.length == 1) {
            result = roots[0];
        } else {
            result = null;
            float[] totalWeights = totalWeights(targetMeshes, armature);
            float greatestTotalWeight = Float.NEGATIVE_INFINITY;
            for (Joint root : roots) {
                int jointIndex = root.getId();
                float weight = totalWeights[jointIndex];
                if (weight > greatestTotalWeight) {
                    result = root;
                    greatestTotalWeight = weight;
                }
            }
        }
        return result;
    }
static Joint findMainJoint ( Armature armature , Mesh [ ] targetMeshes ) { Validate . nonNull ( targetMeshes , "target meshes" ) ; Joint [ ] roots = armature . getRoots ( ) ; Joint result ; if ( roots . length == 1 ) { result = roots [ 0 ] ; } else { result = null ; float [ ] totalWeights = totalWeights ( targetMeshes , armature ) ; float greatestTotalWeight = Float . NEGATIVE_INFINITY ; for ( Joint root : roots ) { int jointIndex = root . getId ( ) ; float weight = totalWeights [ jointIndex ] ; if ( weight > greatestTotalWeight ) { result = root ; greatestTotalWeight = weight ; } } } return result ; }
Find the main root joint of an Armature, based on its total mesh weight.
Find the main root joint of an Armature based on its total mesh weight .