本文整理汇总了C#中UMAData.GetBoneGameObject方法的典型用法代码示例。如果您正苦于以下问题:C# UMAData.GetBoneGameObject方法的具体用法?C# UMAData.GetBoneGameObject怎么用?C# UMAData.GetBoneGameObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UMAData
的用法示例。
在下文中一共展示了UMAData.GetBoneGameObject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnDnaApplied
public void OnDnaApplied(UMAData umaData)
{
if (!hashesFound)
{
leftHandHash = UMAUtils.StringToHash("LeftHand");
rightHandHash = UMAUtils.StringToHash("RightHand");
leftTwistHash = UMAUtils.StringToHash("LeftForeArmTwist");
rightTwistHash = UMAUtils.StringToHash("RightForeArmTwist");
hashesFound = true;
}
GameObject leftHand = umaData.GetBoneGameObject(leftHandHash);
GameObject rightHand = umaData.GetBoneGameObject(rightHandHash);
GameObject leftTwist = umaData.GetBoneGameObject(leftTwistHash);
GameObject rightTwist = umaData.GetBoneGameObject(rightTwistHash);
if ((leftHand == null) || (rightHand == null) || (leftTwist == null) || (rightTwist == null))
{
Debug.LogError("Failed to add Forearm Twist to: " + umaData.name);
return;
}
var twist = umaData.umaRoot.AddComponent<TwistBones>();
twist.twistValue = 0.5f;
twist.twistBone = new Transform[] {leftTwist.transform, rightTwist.transform};
twist.refBone = new Transform[] {leftHand.transform, rightHand.transform};
}
示例2: characterCreated
public void characterCreated(UMAData umaCreated)
{
head = umaCreated.GetBoneGameObject("Head");
MoveCamera();
player = gameObject.GetComponentInChildren<UMAExpressionPlayer>();
if (player == null)
{
Animator umaAnimator = GetComponentInChildren<Animator>();
if (umaAnimator != null)
{
player = umaAnimator.gameObject.AddComponent<UMAExpressionPlayer>();
player.overrideMecanimNeck = true;
player.overrideMecanimHead = true;
player.overrideMecanimJaw = true;
player.overrideMecanimEyes = true;
}
#if !UNITY_4_3
umaAnimator.Rebind();
#endif
}
if (player != null)
{
if (expressionSet != null)
{
player.expressionSet = expressionSet;
}
player.Initialize();
guiValues = new float[UMAExpressionPlayer.PoseCount];
}
}
示例3: 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;
}
示例4: 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;
}