如何使用跳跃运动传感器统一检测双手

时间:2016-12-02 17:31:49

标签: c# unity3d leap-motion

我可以在此代码中检测到我的左手和右手:

using UnityEngine;
using System.Collections.Generic;
using Leap;
using Leap.Unity;

public class Swimming : MonoBehaviour {
LeapProvider provider;

void Start ()
{
    provider = FindObjectOfType<LeapProvider>() as LeapProvider;
}

void Update ()
{
    Frame frame = provider.CurrentFrame;
    foreach (Hand hand in frame.Hands)
    {
        if (hand.IsLeft) {
            Debug.Log ("Left hand is present");
        } else if (hand.IsRight) {
            Debug.Log ("Right hand is present");
        }
        if(hand.IsLeft && hand.IsRight == true){
            Debug.Log ("Both hand are present");
        }
    }
}
}

到目前为止,这是我的代码,但是当我尝试双手进行跳跃运动时,debug.log(&#34;双手都存在&#34;);不工作。 请有人帮帮我

0 个答案:

没有答案