HumanDescription.Human has a different index system than HumanBodyBones
So I'm trying to access the Humandescription for a bone, and the transform for the bone at the same time.
But the problem i bumped is that they use a different index system. animator.GetBoneTransform use enum type HumanBodyBones to access the transform. However when I use humanDescription.human[(int) humanBodyBones] to access the bone description, i realized they have a different index system. For example, for right hand they share the same index, but when comes to Right_Middle_Proximal . It's located at humanDescription.human[36], but (int) humanBodyBones has a value of 45, which is out of the range.
So i wonder what is the correct way of accessing description for bone.
Thanks in advance.
Answer by libra34567 · Feb 19, 2018 at 11:08 AM
Current I'm creating a boneIndex mapping to work arround it. Here is my code:
humanBodyBonesIndexMap.Clear();
foreach (HumanBodyBones boneEnum in Enum.GetValues(typeof(HumanBodyBones)))
{
for (int humanDesIndex = 0; humanDesIndex < humanoidDes.human.Length; humanDesIndex++)
{
if (humanoidDes.human[humanDesIndex].humanName.Replace(" ", "") == boneEnum.ToString())
{
humanBodyBonesIndexMap.Add(boneEnum, humanDesIndex);
break;
}
}
}
Your answer
Follow this Question
Related Questions
Alter Unity Humanoid Bone Local Axis 0 Answers
Not Enough Bones 1 Answer
Accessing Humanoid muscles through script 0 Answers
Mixamo Average position errors after converting to humanoid 2 Answers
what is the [bones] of a fbx files? 1 Answer