本文整理汇总了C#中JointType.ToInt方法的典型用法代码示例。如果您正苦于以下问题:C# JointType.ToInt方法的具体用法?C# JointType.ToInt怎么用?C# JointType.ToInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JointType
的用法示例。
在下文中一共展示了JointType.ToInt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateHand
/// <summary>
/// Lefts the hand.
/// </summary>
/// <returns>The hand.</returns>
/// <param name="hand">Frame.</param>
/// <param name="jt"></param>
private static IEnumerable<BodyPart> CreateHand(Hand hand, JointType jt)
{
var palmNormal = hand.PalmNormal;
var handPosition = hand.PalmPosition;
var handPart = new BodyPart
{
Id = jt.ToInt(),
Rotation = new Vector4(palmNormal.x, palmNormal.y, palmNormal.z, 0),
Position = new Vector3(handPosition.x, handPosition.y, handPosition.z),
Velocity = new Vector3(hand.PalmVelocity.x, hand.PalmVelocity.y, hand.PalmVelocity.z)
};
// TODO: should we add the hand palm to the list?
var parts = new List<BodyPart> { };
parts.AddRange(
hand.Fingers.Select(
finger => CreateFinger(finger, FingerType2JointType(finger.Type, JointType.HAND_LEFT == jt ? 1 : -1))
).SelectMany(x => x)
);
return parts;
}
示例2: BoneType2JointType
private static JointType BoneType2JointType(JointType fingerType, Bone.BoneType type)
{
int jt;
switch (type)
{
case Bone.BoneType.TYPE_METACARPAL:
jt = 1;
break;
case Bone.BoneType.TYPE_PROXIMAL:
jt = 2;
break;
case Bone.BoneType.TYPE_INTERMEDIATE:
jt = 3;
break;
case Bone.BoneType.TYPE_DISTAL:
jt = 4;
break;
default:
return JointType.UNSPECIFIED;
}
jt += fingerType.ToInt();
return (JointType) jt;
}