Version: 2017.1

HumanBone

struct in UnityEngine

切换到手册

描述

模型中的骨骼与 Mecanim 人体解剖学中的概念骨骼之间的映射。

Mecanim 人体骨骼和模型中的骨骼名称随限制肌肉值(用于在动画期间限制骨骼的旋转)一并存储。

using UnityEngine;
using System.Collections.Generic;

public class ExampleClass : MonoBehaviour { void Start() { Dictionary<string, string> boneName = new System.Collections.Generic.Dictionary<string, string>(); 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++; } } }

另请参阅:HumanDescriptionAvatarBuilder

变量

boneNameMecanim 人体骨骼所映射到的骨骼的名称。
humanName模型中的骨骼所映射到的 Mecanim 人体骨骼的名称。
limit定义该骨骼对应肌肉的旋转限制。
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961