unit – Detection of the nearest bone

I want to show a stream of blood when an enemy is hit.

I have a Vector3 (local coords), which indicates where the enemy has been hit.

At the beginning of my damage script, I store the reference of each bone for the enemy model like this:

Private list _bones = new list();

void Home ()
foreach (var g in MeshObject.GetComponentsInChildren())
Debug.Log (g.name + " n");
_bones.Add (g);

Then, when the enemy has been hit, I want to breed the prefab blood stream for the nearest bone. In this way, the blood stream will move along with the bone during the blow animation.

To locate the nearest bone, I use this approach:

Private transformation pGetClosestBone (Vector3 uLocalHitPos)
Transform bestTarget = null;
float closestDistanceSqr = Mathf.Infinity;

foreach (Transform potentialTarget in _bones)
Vector3 directionToTarget = potentialTarget.localPosition - uLocalHitPos;
float dSqrToTarget = directionToTarget.sqrMagnitude;
if (dSqrToTarget <closestDistanceSqr)
closestDistanceSqr = dSqrToTarget;
bestTarget = potentialTarget;

returns bestTarget;

For me, this code looks good, but in reality, "potentialTarget.localPosition" is always (0, 0, 0).

Of course, I could try to use the Objective Proposition function to get the world's chords, but I really wonder why the local position does not work.

Thanks for any information.