1

I can detect my left and right hand in this code:

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");
        }
    }
}
}

So far it this is my code but when i try my both hands infront of the leap motion the debug.log("both hands are present"); isn't working. can someone help me please

  • From looking at the code I would assume that one hand can not be both a left hand and a right hand at once. I'd rather assume, that in a frame where both hands are present, `frame.Hands` will have two elements: one left hand, and one right hand. – Thomas Hilbert Dec 03 '16 at 15:48
  • This is already been solved sir . but thanks anyway :) –  Dec 07 '16 at 15:36

0 Answers0