private static float[] vertexBoneWeights(Mesh mesh,
            int vertexIndex, float[] storeResult) {
        if (storeResult == null) {
            storeResult = new float[4];
        } else {
            assert storeResult.length >= 4 : storeResult.length;
        }

        int maxWeightsPerVert = mesh.getMaxNumWeights();
        if (maxWeightsPerVert <= 0) {
            maxWeightsPerVert = 1;
        }

        VertexBuffer wBuf = mesh.getBuffer(VertexBuffer.Type.BoneWeight);
        FloatBuffer weightBuffer = (FloatBuffer) wBuf.getDataReadOnly();
        weightBuffer.position(4 * vertexIndex);
        for (int wIndex = 0; wIndex < maxWeightsPerVert; ++wIndex) {
            storeResult[wIndex] = weightBuffer.get();
        }
        /*
         * Fill with 0s.
         */
        int length = storeResult.length;
        for (int wIndex = maxWeightsPerVert; wIndex < length; ++wIndex) {
            storeResult[wIndex] = 0f;
        }

        return storeResult;
    }
Copy the bone weights for the indexed vertex.

@param mesh subject mesh (not null)
@param vertexIndex index into the mesh's vertices (&ge;0)
@param storeResult (modified if not null)
@return the data vector (either storeResult or a new instance)
jme3-jbullet/src/main/java/com/jme3/bullet/animation/RagUtils.java