当前位置: 首页>>代码示例>>C#>>正文


C# UMAData.GetAnimatedBones方法代码示例

本文整理汇总了C#中UMAData.GetAnimatedBones方法的典型用法代码示例。如果您正苦于以下问题:C# UMAData.GetAnimatedBones方法的具体用法?C# UMAData.GetAnimatedBones怎么用?C# UMAData.GetAnimatedBones使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UMAData的用法示例。


在下文中一共展示了UMAData.GetAnimatedBones方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateHumanDescription

        public static HumanDescription CreateHumanDescription(UMAData umaData, UmaTPose umaTPose)
        {
            var res = new HumanDescription();
            res.armStretch = 0;
            res.feetSpacing = 0;
            res.legStretch = 0;
            res.lowerArmTwist = 0.2f;
            res.lowerLegTwist = 1f;
            res.upperArmTwist = 0.5f;
            res.upperLegTwist = 0.1f;

            var animatedBones = umaData.GetAnimatedBones();
            if (animatedBones.Length > 0)
            {
                List<SkeletonBone> animatedSkeleton = new List<SkeletonBone>(umaTPose.boneInfo);

                foreach (var animatedBoneHash in animatedBones)
                {
                    var animatedBone = umaData.GetBoneGameObject(animatedBoneHash).transform;

                    var sb = new SkeletonBone();
                    sb.name = animatedBone.name;
                    sb.position = animatedBone.localPosition;
                    sb.rotation = animatedBone.localRotation;
                    sb.scale = animatedBone.localScale;
                    animatedSkeleton.Add(sb);
                }
                res.skeleton = animatedSkeleton.ToArray();
            }
            else
            {
                res.skeleton = umaTPose.boneInfo;
            }

            //			List<HumanBone> animatedHuman = new List<HumanBone>();
            //			foreach (HumanBone bone in umaTPose.humanInfo) {
            //				int animIndex = System.Array.IndexOf(umaData.animatedBones, bone.boneName);
            //				if (animIndex > -1) {
            //					animatedHuman.Add(bone);
            //				}
            //				else {
            //					int traitIndex = System.Array.IndexOf(HumanTrait.BoneName, bone.humanName);
            //					if (HumanTrait.RequiredBone(traitIndex)) {
            //						animatedHuman.Add(bone);
            //					}
            //				}
            //			}
            //			List<SkeletonBone> animatedSkeleton = new List<SkeletonBone>();
            //			foreach (SkeletonBone bone in umaTPose.boneInfo) {
            //				int animIndex = System.Array.IndexOf(umaData.animatedBones, bone.name);
            //				if (animIndex > -1) {
            //					animatedSkeleton.Add(bone);
            //				}
            //			}
            //			res.human = animatedHuman.ToArray();
            //			res.skeleton = animatedSkeleton.ToArray();
            res.human = umaTPose.humanInfo;

            res.skeleton[0].name = umaData.umaRoot.name;
            SkeletonModifier(umaData, ref res.skeleton);
            return res;
        }
开发者ID:RapsFan,项目名称:UMA,代码行数:62,代码来源:UMAGeneratorBase.cs

示例2: CreateHumanDescription

		/// <summary>
		/// Creates a Mecanim human description for a UMA character.
		/// </summary>
		/// <returns>The human description.</returns>
		/// <param name="umaData">UMA data.</param>
		/// <param name="umaTPose">UMA TPose.</param>
		public static HumanDescription CreateHumanDescription(UMAData umaData, UmaTPose umaTPose)
		{
			var res = new HumanDescription();
			res.armStretch = 0;
			res.feetSpacing = 0;
			res.legStretch = 0;
			res.lowerArmTwist = 0.2f;
			res.lowerLegTwist = 1f;
			res.upperArmTwist = 0.5f;
			res.upperLegTwist = 0.1f;

			var animatedBones = umaData.GetAnimatedBones();
			if (animatedBones.Length > 0)
			{
				List<SkeletonBone> animatedSkeleton = new List<SkeletonBone>(umaTPose.boneInfo);

				foreach (var animatedBoneHash in animatedBones)
				{
					var animatedBone = umaData.GetBoneGameObject(animatedBoneHash).transform;

					var sb = new SkeletonBone();
					sb.name = animatedBone.name;
					sb.position = animatedBone.localPosition;
					sb.rotation = animatedBone.localRotation;
					sb.scale = animatedBone.localScale;
					animatedSkeleton.Add(sb);
				}
				res.skeleton = animatedSkeleton.ToArray();
			} else
			{
				res.skeleton = umaTPose.boneInfo;
			}

			res.human = umaTPose.humanInfo;

			SkeletonModifier(umaData, ref res.skeleton, res.human);
			return res;
		}
开发者ID:BillDStrong,项目名称:UMA,代码行数:44,代码来源:UMAGeneratorBase.cs


注:本文中的UMAData.GetAnimatedBones方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。