HumanBone

Unity · Версия 2020.3 LTS · Scripting

HumanBone

Описание

Сопоставление кости в модели и концептуальной кости в анатомии человека Mecanim.

Имена человеческой кости Mecanim и кости в модели сохраняются вместе с ограничивающими значениями мышц, ограничивающими вращение кости во время анимации.

using UnityEngine;
using System.Collections.Generic;

public class ExampleClass : MonoBehaviour
{
    void Start()
    {
        Dictionary boneName = new System.Collections.Generic.Dictionary();
        boneName["Chest"] = "Bip001 Spine2";
        boneName["Head"] = "Bip001 Head";
        boneName["Hips"] = "Bip001 Pelvis";
        boneName["LeftFoot"] = "Bip001 L Foot";
        boneName["LeftHand"] = "Bip001 L Hand";
        boneName["LeftLowerArm"] = "Bip001 L Forearm";
        boneName["LeftLowerLeg"] = "Bip001 L Calf";
        boneName["LeftShoulder"] = "Bip001 L Clavicle";
        boneName["LeftUpperArm"] = "Bip001 L UpperArm";
        boneName["LeftUpperLeg"] = "Bip001 L Thigh";
        boneName["RightFoot"] = "Bip001 R Foot";
        boneName["RightHand"] = "Bip001 R Hand";
        boneName["RightLowerArm"] = "Bip001 R Forearm";
        boneName["RightLowerLeg"] = "Bip001 R Calf";
        boneName["RightShoulder"] = "Bip001 R Clavicle";
        boneName["RightUpperArm"] = "Bip001 R UpperArm";
        boneName["RightUpperLeg"] = "Bip001 R Thigh";
        boneName["Spine"] = "Bip001 Spine1";
        string[] humanName = HumanTrait.BoneName;
        HumanBone[] humanBones = new HumanBone[boneName.Count];
        int j = 0;
        int i = 0;
        while (i < humanName.Length)
        {
            if (boneName.ContainsKey(humanName[i]))
            {
                HumanBone humanBone = new HumanBone();
                humanBone.humanName = humanName[i];
                humanBone.boneName = boneName[humanName[i]];
                humanBone.limit.useDefaultValues = true;
                humanBones[j++] = humanBone;
            }
            i++;
        }
    }
}

Смотрите так же: HumanDescription, AvatarBuilder.

Свойства

boneName Название кости, с которой сопоставлена человеческая кость Mecanim.
humanName Имя человеческой кости Mecanim, с которой сопоставлена кость из модели.
limit Пределы вращения, определяющие мышцу этой кости.

Обновлено 17 ноября 2026 г.