Ich mache ein Spiel, in dem das Speicher- und Lade-System angezeigt wird, wenn ich mit der Handfläche nach oben schaue. Das Problem ist, ich weiß nicht, wie ich feststellen kann, ob meine Handfläche nach oben zeigt. Alles, was ich weiß, ist, wie man den Abstand und die Position der Handfläche erreicht.So erkennen Sie, ob die Hand in der Leap-Bewegung nach oben zeigt (C#) Unity
Ich versuchte dies:
using Leap;
using Leap.Unity;
public class GetPamlPositionLeap : MonoBehaviour {
LeapProvider provider;
// Use this for initialization
void Start() {
provider = FindObjectOfType<LeapProvider>() as LeapProvider;
}
// Update is called once per frame
void Update() {
Frame frame = provider.CurrentFrame;
Hand hand = frame.Hand [0]; // cannot apply indexing
Vector position = hand.PalmPosition;
Vector direction = hand.Direction;
Debug.Log ("The position of hand is" + position + "The direction of hand is" + direction);
}
}
Aber es gibt Fehler:
cannot apply indexing to an expression type
können Sie mir eine Probe dieses Herrn zeigen. Bitte – TheGinxx009
Siehe die PalmWatcher-Funktion hier: https://github.com/leapmotion/UnityModules/blob/develop/Assets/LeapMotion/Scripts/DetectionUtilities/PalmDirectionDetector.cs –