private static List<Float> getPoints(Mesh mesh, int boneIndex, Vector3f initialScale, Vector3f offset, float weightThreshold) {

        FloatBuffer vertices = mesh.getFloatBuffer(Type.Position);
        VertexBuffer biBuf = mesh.getBuffer(VertexBuffer.Type.BoneIndex);
        Buffer boneIndices = biBuf.getDataReadOnly();
        FloatBuffer boneWeight = (FloatBuffer) mesh.getBuffer(Type.BoneWeight).getData();

        vertices.rewind();
        boneIndices.rewind();
        boneWeight.rewind();

        ArrayList<Float> results = new ArrayList<>();

        int vertexComponents = mesh.getVertexCount() * 3;

        for (int i = 0; i < vertexComponents; i += 3) {
            int k;
            boolean add = false;
            int start = i / 3 * 4;
            for (k = start; k < start + 4; k++) {
                if (readIndex(boneIndices, k) == boneIndex
                        && boneWeight.get(k) >= weightThreshold) {
                    add = true;
                    break;
                }
            }
            if (add) {

                Vector3f pos = new Vector3f();
                pos.x = vertices.get(i);
                pos.y = vertices.get(i + 1);
                pos.z = vertices.get(i + 2);
                pos.subtractLocal(offset).multLocal(initialScale);
                results.add(pos.x);
                results.add(pos.y);
                results.add(pos.z);

            }
        }

        return results;
    }
Enumerate vertices that meet the weight threshold for the indexed bone.

@param mesh the mesh to analyze (not null)
@param boneIndex the index of the bone (&ge;0)
@param initialScale a scale applied to vertex positions (not null,
unaffected)
@param offset an offset subtracted from vertex positions (not null,
unaffected)
@param weightThreshold the minimum bone weight for inclusion in the
result (&ge;0, &le;1)
@return a new list of vertex coordinates (not null, length a multiple of
3)
jme3-jbullet/src/main/java/com/jme3/bullet/control/ragdoll/RagdollUtils.java