本文整理汇总了C#中HandModel.GetPalmNormal方法的典型用法代码示例。如果您正苦于以下问题:C# HandModel.GetPalmNormal方法的具体用法?C# HandModel.GetPalmNormal怎么用?C# HandModel.GetPalmNormal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HandModel
的用法示例。
在下文中一共展示了HandModel.GetPalmNormal方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFireBallSpawnPosition
Vector3 GetFireBallSpawnPosition(HandModel hand, float distance){
Vector3 palmPos = hand.GetPalmPosition ();
Vector3 palmDir = hand.GetPalmNormal ();
return palmPos + Vector3.Scale(palmDir,new Vector3(distance,distance,distance));
}
示例2: IsPalmFacingDownwards
public static bool IsPalmFacingDownwards(HandModel hand, float theta){
Vector3 dir = hand.GetPalmNormal ();
float angle = Vector3.Angle (dir, -1* hand.transform.up);
if (Math.Abs (angle) <= theta)
return true;
return false;
}
示例3: Fire
IEnumerator Fire(HandModel currentHand)
{
canFire = false;
//Debug.Log (canFire);
GameObject justFired = Instantiate (ammo, currentHand.transform.position + currentHand.GetPalmNormal() * offset , currentHand.GetPalmRotation()) as GameObject;
justFired.GetComponent<moveProjectile> ().target = target;
//justFired.GetComponent<moveProjectile> ().force = Quaternion.LookRotation( handController.transform.forward, Vector3.down).eulerAngles;
yield return new WaitForSeconds (delay);
canFire = true;
}
示例4: AngleBetweenPalmsNormals
public static float AngleBetweenPalmsNormals(HandModel leftHand, HandModel rightHand, Vector3 projectPlane){
Vector3 leftPalmNorm = leftHand.GetPalmNormal ();
Vector3 rightPalmNorm = rightHand.GetPalmNormal ();
Vector3 leftPalmNormProj = Math3d.ProjectVectorOnPlane (projectPlane,leftPalmNorm).normalized;
Vector3 rightPalmNormProj = Math3d.ProjectVectorOnPlane (projectPlane,rightPalmNorm).normalized;
float angle = Math3d.SignedVectorAngle (leftPalmNorm, rightPalmNorm,projectPlane);
return angle;
}
示例5: IsPalmFacingUpwards
// //Detect if index finger, middle finger, ring finger and little finger are straight (not bent).
// public static bool FourFingersStraight(HandModel hand){
//
// return !IsIndexFingerBent (hand, 3) && !IsMiddleFingerBent (hand, 3) && !IsRingFingerBent (hand, 3)
// && !IsLittleFingerBent (hand, 3);
//
// }
//
public static bool IsPalmFacingUpwards(HandModel hand, float theta ){
Vector3 dir = hand.GetPalmNormal ();
//Vector3 worldUp = hand.transform.TransformDirection(hand.transform.up);
float angle = Vector3.Angle (dir, hand.transform.up);
//Debug.Log (angle);
if (Math.Abs (angle) <= theta)
return true;
return false;
}
示例6: IsFingerBentWithinAngle
public static bool IsFingerBentWithinAngle(HandModel hand, int fingerIndex, int boneIndex, float minAngle, float maxAngle){
FingerModel finger = hand.fingers [fingerIndex];
Vector3 fingerDir = finger.GetBoneDirection (boneIndex);
Vector3 palmNormal = hand.GetPalmNormal ();
Vector3 palmDir = hand.GetPalmDirection ();
if (fingerIndex == 0) {
float angle = Math3d.SignedVectorAngle (palmDir, fingerDir, palmNormal);
//Debug.Log ("Finger: " + finger.fingerType + ", bone: " + boneIndex + ", angle to palm direction: " + angle);
if (angle >= minAngle && angle <= maxAngle)
return true;
} else if (fingerIndex > 0) {
Vector3 projPlane = Vector3.Cross(palmNormal, palmDir).normalized;
Vector3 projVector = Math3d.ProjectVectorOnPlane(projPlane,fingerDir).normalized;
float angle = Math3d.SignedVectorAngle(palmNormal,projVector,projPlane);
//Debug.Log ("Finger: " + finger.fingerType + ", bone: " + boneIndex + ", angle to palm direction: " + angle);
if (angle >= minAngle && angle <= maxAngle)
return true;
}
return false;
}
示例7: AngleBetweenFingerAndPalmDirection
public static float AngleBetweenFingerAndPalmDirection(HandModel hand, int fingerIndex, int boneIndex){
Vector3 palmVector = hand.GetPalmDirection ();
Vector3 palmNormal = hand.GetPalmNormal ();
Vector3 crossVect = Vector3.Cross (palmVector, palmNormal).normalized;
//Debug.Log (crossVect.normalized);
float angle = AngleBetweenFingerAndVector (hand, fingerIndex, boneIndex, palmVector, crossVect);
return angle;
// if (fingerIndex == 0) {
//
// if (hand.GetLeapHand ().IsRight) {
// return angle;
// } else {
// return -angle;
// }
//
// } else {
//
// return -angle;
// }
//
}
示例8: AngleBetweenFingerTipsHorizontal
public static float AngleBetweenFingerTipsHorizontal(HandModel hand, int fingerIndexOne, int fingerIndexTwo){
float angle = AngleBetweenFingerTips(hand,fingerIndexOne, fingerIndexTwo,hand.GetPalmNormal());
if (hand.GetLeapHand ().IsRight)
return -angle;
return angle;
}
示例9: AngleBetweenFingerTipsVertical
public static float AngleBetweenFingerTipsVertical(HandModel hand, int fingerIndexOne, int fingerIndexTwo){
Vector3 palmVector = hand.GetPalmDirection ();
Vector3 palmNormal = hand.GetPalmNormal ();
Vector3 crossVect = Vector3.Cross (palmVector, palmNormal).normalized;
return AngleBetweenFingerTips (hand, fingerIndexOne, fingerIndexTwo, crossVect);
}