private static Bone FindClosestBone(Vector3 v, Bone[] bones)
    {
        Bone bmin = null;
        float minDist = float.MaxValue;

        foreach (Bone b in bones.Where(b => b.deform)) {
            float dist = (b.transform.localPosition - v).sqrMagnitude;
            if (dist < minDist) {
                minDist = dist;
                bmin = b;
            }
        }

        return bmin;
    }