Пример #1
0
 public void DireccionDelMovimiento()
 {
     if (firstHand != null)
     {
         Vector posMano = firstHand.PalmPosition;
         if (posMano.y >= topeN)
         {
             pos = "Norte";
         }
         if (posMano.y <= topeS)
         {
             pos = "Sur";
         }
         if (posMano.x <= topeO)
         {
             pos = "Oeste";
         }
         if (posMano.x >= topeE)
         {
             pos = "Este";
         }
         if (posMano.y >= topeN && posMano.x >= topeE)
         {
             pos = "NorEste";
         }
         if (posMano.y >= topeN && posMano.x <= topeO)
         {
             pos = "NorOeste";
         }
         if (posMano.y <= topeS && posMano.x >= topeE)
         {
             pos = "SudEste";
         }
         if (posMano.y <= topeS && posMano.x <= topeO)
         {
             pos = "SudOeste";
         }
         if (posMano.y < topeN && posMano.y > topeS && posMano.x < topeE && posMano.x > topeO)
         {
             pos = "Centro";
         }
         if (dedos.Extended().Count == 1)
         {
             Mover(pos);
         }
         else
         {
             pos = " ";
         }
         polo.GetComponent <Text>().text = pos;
     }
 }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        if (Seleccionado.elegido == true && yapaso == false)
        {
            Proxim.GetComponent <UnityEngine.UI.Image> ().color = Color.green;
        }
        frameActual = controller.Frame();         //obtengo la informacion del leap de un frame



        if (frameActual.Hands.Count > 0)
        {
            HandList hands = frameActual.Hands;
            firstHand = hands[0];
        }

        FingerList dedos = frameActual.Fingers;         //obtengo todos los dedos detectados en un frame

        dedos_extendidos = 0;

        for (int i = 0; i < dedos.Extended().Count; i++)
        {
            dedos_extendidos++;            //cuento todos los dedos que estan extendidos de la FingerList dedos
        }
    }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        if (tiempoentregestos == 350)
        {
            cerrarapp         = 0;
            tiempoentregestos = 0;
        }
        frameActual = controller.Frame();         //obtengo la informacion del leap de un frame


        GestureList gestos = frameActual.Gestures();

        if (frameActual.Hands.Count > 0)
        {
            HandList hands = frameActual.Hands;
            firstHand = hands[0];
        }

        FingerList dedos            = frameActual.Fingers; //obtengo todos los dedos detectados en un frame
        int        dedos_extendidos = 0;

        for (int i = 0; i < dedos.Extended().Count; i++)
        {
            dedos_extendidos++;            //cuento todos los dedos que estan extendidos de la FingerList dedos
        }
        if (dedos_extendidos == 5)
        {
            switch (boton)
            {
            case "BodyMotion":
                break;

            case "EarthMotion":
                SceneManager.LoadScene(0);
                break;

            case "VisualMotion":
                SceneManager.LoadScene(1);
                break;

            case "RollingRoshakazu":
                SceneManager.LoadScene(4);
                break;
            }
        }
        for (int i = 0; i < gestos.Count; i++)
        {
            if (gestos [i].Type == Gesture.GestureType.TYPECIRCLE && dedos_extendidos == 1)
            {
                if (cerrarapp == 5)
                {
                    UnityEditor.EditorApplication.isPlaying = false;
                }
                cerrarapp++;
                tiempoentregestos = 0;
            }
        }
        tiempoentregestos++;
    }
Пример #4
0
    // Update is called once per frame
    void Update()
    {
        frameActual = controller.Frame();         //obtengo la informacion del leap de un frame
        if (frameActual.Hands.Count > 0)
        {
            HandList hands = frameActual.Hands;
            firstHand = hands[0];
        }

        FingerList dedos            = frameActual.Fingers; //obtengo todos los dedos detectados en un frame
        int        dedos_extendidos = 0;

        for (int i = 0; i < dedos.Extended().Count; i++)
        {
            dedos_extendidos++;            //cuento todos los dedos que estan extendidos de la FingerList dedos
        }
        if (dedos_extendidos == 2)
        {
            if (fuetocado == true)
            {
                fuetocado = false;
                HabilitarDes(Princi, false);             //Esconde el boton Principiante
                HabilitarDes(Inter, false);              //Esconde el boton Intermedio
                HabilitarDes(Avan, false);               //Esconde el boton Avanzado
                HabilitarDes(Nave, true);                //Muestra El boton Navegar
                HabilitarDes(Qui, true);                 //Muestra El boton Quiz
                if (Listo3 == true)
                {
                    Listo3 = false;
                    if (Listo3 == false)
                    {
                        SceneManager.LoadScene(3);
                    }
                }
            }
        }
        if (dedos_extendidos == 5)
        {
            if (Listo1 == true)
            {
                Listo1 = false;
                if (Listo1 == false)
                {
                    SceneManager.LoadScene(1);
                }
            }
            else
            {
                if (Listo2 == true)
                {
                    Listo2 = false;
                    if (Listo2 == false)
                    {
                        SceneManager.LoadScene(2);
                    }
                }
            }
        }
    }
Пример #5
0
    // Update is called once per frame
    void Update()
    {
        frameActual = controller.Frame();         //obtengo la informacion del leap de un frame
        if (frameActual.Hands.Count > 0)
        {
            HandList hands = frameActual.Hands;
            firstHand = hands[0];
        }

        FingerList dedos            = frameActual.Fingers; //obtengo todos los dedos detectados en un frame
        int        dedos_extendidos = 0;

        for (int i = 0; i < dedos.Extended().Count; i++)
        {
            dedos_extendidos++;            //cuento todos los dedos que estan extendidos de la FingerList dedos
        }
        try
        {
            Vector posMano = firstHand.PalmPosition;
            if (posMano.x <= -50)
            {
                pos = "Oeste";
            }
            if (posMano.x >= 90)
            {
                pos = "Este";
            }
        }
        catch
        {
            //Debug.Log("Coloque las manos dentro del alcance del Leap");
            pos = "Centro";
        }

        if (dedos_extendidos == 3)
        {
            Mover(pos);
            contador++;
        }
    }
Пример #6
0
    void Update()
    {
        frameActual = controller.Frame();         //obtengo la informacion del leap de un frame

        if (frameActual.Hands.Count > 0)
        {
            HandList hands = frameActual.Hands;
            firstHand = hands[0];
        }

        FingerList dedos = frameActual.Fingers;         //obtengo todos los dedos detectados en un frame

        dedos_extendidos = 0;

        for (int i = 0; i < dedos.Extended().Count; i++)
        {
            dedos_extendidos++;            //cuento todos los dedos que estan extendidos de la FingerList dedos
        }
        if (comen == true)
        {
            GameObject.Find("Comenzar").gameObject.SetActive(false);
        }
    }
Пример #7
0
    void Update()
    {
        frameActual = controller.Frame();  // Obtengo la informacion del leap de un frame
        dedos       = frameActual.Fingers; // Obtengo todos los dedos detectados en un frame
        zoom        = false;

        if (frameActual.Hands.Count > 0)
        {
            HandList hands = frameActual.Hands;
            firstHand = hands[0];
            if (giroautomatico == 0)    // Si se interrumpe el giro automatico por AFK
            {
                giroautomatico = 500;
                BotonesSeba.temp_file.transform.rotation = Quaternion.Euler(0f, 0f, 0f);
            }
        }

        if (BotonesSeba.temp_file != null)
        {
            #region Rotacion del Objeto
            Vector posMano = firstHand.PalmPosition;
            if (posMano.y >= 300)
            {
                pos = "Norte";
            }
            if (posMano.y <= 150)
            {
                pos = "Sur";
            }
            if (posMano.x <= -50)
            {
                pos = "Oeste";
            }
            if (posMano.x >= 90)
            {
                pos = "Este";
            }

            if (dedos.Extended().Count == 1)
            {
                Mover(pos);
            }
            #endregion
            #region Girar objeto automaticamente
            // Girar automaticamente al estar AFK
            if (frameActual.Hands.Count == 0)
            {
                if (giroautomatico > 0)
                {
                    giroautomatico -= 1;
                }
                if (giroautomatico <= 0)
                {
                    BotonesSeba.temp_file.transform.rotation = Quaternion.Euler(new Vector3(0f, BotonesSeba.temp_file.transform.eulerAngles.y + 0.5f, 0f));
                }
            }
            #endregion
        }
        #region Panel de Control
        foreach (var mano in controller.Frame().Hands)
        {
            if (BotonesSeba.seleccionado == true)
            {
                if (mano.IsLeft)
                {
                    float grados = 140f * Mathf.Deg2Rad;
                    if (mano.PalmNormal.Roll > grados && canvas_mano.GetComponent <Canvas>().enabled == false)
                    {
                        ModificarComponentesCanvas(true, ref canvas_mano);
                    }
                    else if (canvas_mano != null && mano.PalmNormal.Roll <= grados)
                    {
                        ModificarComponentesCanvas(false, ref canvas_mano);
                    }
                }
                if (frameActual.Hands.Count < 2)
                {
                    ModificarComponentesCanvas(false, ref canvas_mano);
                }
            }
            else
            {
                ModificarComponentesCanvas(false, ref canvas_mano);
            }
        }
        #endregion
    }
Пример #8
0
            public override void OnFrame(Controller leap)
            {
                var frame = leap.Frame();

#if false
                // 今回のフレームで検出したすべての手、指、ツール
                HandList      hands      = frame.Hands;
                FingerList    fingers    = frame.Fingers;
                ToolList      tools      = frame.Tools;
                PointableList pointables = frame.Pointables;

                Console.WriteLine(string.Format(
                                      "Frame Data : Hands : {0} Fingers : {1} Extended Fingers : {2} Tools : {3} Pointers : {4}",
                                      hands.Count, fingers.Count, fingers.Extended().Count, tools.Count, pointables.Count));
#endif

#if false
                // 手のIDから、同じ手を追跡し続ける
                if (handId == -1)
                {
                    handId = frame.Hands[0].Id;
                }
                else
                {
                    Hand hand = frame.Hand(handId);
                    handId = hand.Id;

                    // 手の情報を表示する
                    Console.WriteLine(string.Format("ID : {0} 位置 : {1} 速度 : {2} 法線 : {3} 向き : {4}",
                                                    hand.Id, hand.PalmPosition, hand.PalmVelocity, hand.PalmNormal, hand.Direction));
                }
#endif

#if false
                // 一番左、右、手前の手を取得する
                HandList hands     = frame.Hands;
                Hand     leftMost  = hands.Leftmost;
                Hand     rightMost = hands.Rightmost;
                Hand     frontMost = hands.Frontmost;

                Console.WriteLine(string.Format("左 : {0} 右 : {1} 手前 : {2}",
                                                leftMost.PalmPosition, rightMost.PalmPosition, frontMost.PalmPosition));
#endif

#if false
                // 手に属している指とツールを取得する
                foreach (var hand in frame.Hands)
                {
                    Console.WriteLine(string.Format("ID : {0} ポインタ : {1} 指: {2} ツール : {3}",
                                                    hand.Id, hand.Pointables.Count, hand.Fingers.Count, hand.Fingers.Count));
                }
#endif

#if false
                // 指の情報を表示する
                foreach (var finger in frame.Fingers)
                {
                    Console.WriteLine(string.Format("ID : {0} 種類 : {1} 位置 : {2} 速度 : {3} 向き : {4}",
                                                    finger.Id, finger.Type, finger.TipPosition, finger.TipVelocity, finger.Direction));
                }
#endif

#if false
                // 指の関節情報を取得する
                foreach (var finger in frame.Fingers)
                {
                    // 末節骨(指先の骨)
                    var bone = finger.Bone(Bone.BoneType.TYPE_DISTAL);
                    Console.WriteLine(string.Format("種類 : {0} 中心 : {1} 上端 : {2} 下端 : {3}",
                                                    bone.Type, bone.Center, bone.PrevJoint, bone.NextJoint));
                }
#endif

#if true
                // 親指の定義を確認する
                foreach (var finger in frame.Fingers)
                {
                    if (finger.Type == Finger.FingerType.TYPE_THUMB)
                    {
                        for (int t = (int)Bone.BoneType.TYPE_METACARPAL; t <= (int)Bone.BoneType.TYPE_DISTAL; t++)
                        {
                            var bone = finger.Bone((Bone.BoneType)t);
                            Console.WriteLine(string.Format("種類 : {0} 長さ : {1}", bone.Type, bone.Length));
                        }
                    }
                }
#endif
            }