Hello there,
somehow I seem to miss something, because I got no problems executing code based on the position of the leftmost or rightmost hand. Unfortunately this only works when two hands are recognized. As soon as only one hand is available it is obviously the leftmost and rightmost hand ![]()
Has anyone got a complete C# script example checking if a hand is left or right and would be kind enough to share?
Leap motions Documentation states it is possible to detect if a hand is a left one or a right one. Unfortunately I can not get this to run: Downloads – Page Array – Ultraleap
if (hand.IsRight) {
// … Do right handed stuff
}
Snippet I used successfully for leftmost / rightmost data:
using UnityEngine;
using System.Collections;
using Leap;
public class LeapLogicBothHands : MonoBehaviour {
Controller controller;
public Vector HandRightPos;
public Vector HandLeftRot;
void Start ()
{
controller = new Controller ();
}
void Update ()
{
Frame frame = controller.Frame ();
HandList hands = frame.Hands;
Hand HandLeft = frame.Hands.Leftmost;
Hand HandRight = frame.Hands.Rightmost;
HandLeftRot = HandLeft.Direction;
Debug.Log ("Left rot: " + HandLeftRot);
HandRightPos = HandRight.PalmPosition;
Debug.Log ("Right pos: " + HandRightPos);
}
}
Thanks
Ralf