Search Unity

Leap Motion & Oculus : Draw Line between points( Hands)

Discussion in 'Scripting' started by fredyyanez, Jun 24, 2015.

  1. fredyyanez

    fredyyanez

    Joined:
    Jul 8, 2014
    Posts:
    33
    I'm trying to draw a line between the palm position of two hands( Leap).
    Im trying to use OnDrawGizmos but for some reason I don't see the line.
    My code:
    Code (CSharp):
    1.     void Update () {
    2.  
    3.  
    4.  
    5.         HandController handController = HMHC.transform.GetComponent<HandController>();
    6.         HandModel[] hands = handController.GetAllGraphicsHands();
    7.      
    8.         leftValid = false;
    9.         rightValid = false;
    10.      
    11.         foreach(HandModel hand in hands)
    12.         {
    13.             Hand leapHand = hand.GetLeapHand();
    14.             if (leapHand.IsRight)
    15.             {
    16.                 rightH = hand;
    17.                 rightValid = true;
    18.             }
    19.             else if (leapHand.IsLeft)
    20.             {
    21.                 leftH = hand;
    22.                 leftValid = true;
    23.             }
    24.         }
    25.         if(leftValid && rightValid){
    26.             leftP=leftH.GetPalmPosition();
    27.             rightP=rightH.GetPalmPosition();
    28.  
    29.         }
    30.  
    31.  
    32.  
    33.     }
    34.  
    35.  
    36.     void OnDrawGizmos() {
    37.         if(leftValid && rightValid){
    38.             Debug.Log("IT WORKSSSS");
    39.             Gizmos.color=Color.red;
    40.             Gizmos.DrawLine(leftP,rightP);
    41.  
    42.        
    If I understand correctly, the OnDrawGizmos gets called every frame. My debug statement does print, but I don't understand why I can't see the line.


    Thanks!


    Update: Now that I look at the documentation closely I think that the Gizmo is not the best way to approach this.: What I need is a Line that is seen in the game view.
     
  2. GroZZleR

    GroZZleR

    Joined:
    Feb 1, 2015
    Posts:
    3,201
  3. bkachmar

    bkachmar

    Joined:
    Mar 15, 2013
    Posts:
    43
  4. dttngan91

    dttngan91

    Joined:
    Nov 21, 2013
    Posts:
    80
    I have a trouble when import the latest Leap motion into Unity Pro 5.1.2 on window 7 64 bit with the error alert "Open file not found LeapCSharp.NET3.5.dll" even though it is there. Has you solved that issue?
     
  5. DonLoquacious

    DonLoquacious

    Joined:
    Feb 24, 2013
    Posts:
    1,667
    Move all of the Leap assets to the root folder, maybe? Instead of that /plugins/ crap.

    https://developer.leapmotion.com/getting-started/unity/free