本文整理汇总了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;
}
示例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;
}