Ejemplo n.º 1
0
    public void rightHandActions()
    {
        GameObject hand = GameObject.Find("CleanRobotRightHand(Clone)");

        //hand is in the current frame
        if (hand != null)
        {
            SkeletalHand skeleton = hand.GetComponent <SkeletalHand>();

            //look for the gestures that exist
            foreach (Gesture g in skeleton.GetLeapHand().Frame.Gestures())
            {
                if (g.Type == Gesture.GestureType.TYPE_CIRCLE && g.Hands.Count == 1 && g.Hands.Frontmost.IsRight)
                {
                    spawner_in_view_.freezeAllTraffic();
                    action_timer = action_time;
                }
                else if (g.Type == Gesture.GestureType.TYPESWIPE && g.Hands.Count == 1 && g.Hands.Frontmost.IsRight)
                {
                    spawner_in_view_.resumeTraffic();
                    action_timer = action_time;
                }
            }
        }
    }
Ejemplo n.º 2
0
    public void leftHandActions()
    {
        GameObject hand = GameObject.Find("CleanRobotLeftHand(Clone)");

        if (hand != null)
        {
            Debug.Log("ing here");
            SkeletalHand skeleton = hand.GetComponent <SkeletalHand>();
            foreach (Gesture g in skeleton.GetLeapHand().Frame.Gestures())
            {
                if (g.Type == Gesture.GestureType.TYPE_CIRCLE && g.Hands.Count == 1 && g.Hands.Frontmost.IsLeft)
                {
                    if (rotate_timer_ < 0)
                    {
                        rotate90(1);
                    }
                }
            }
        }
    }
Ejemplo n.º 3
0
    void Update()
    {
        SkeletalHand skeletal_hand = GetComponent <SkeletalHand>();
        Hand         leap_hand     = skeletal_hand.GetLeapHand();

        if (leap_hand == null)
        {
            return;
        }

        if (leap_hand.GrabStrength < GRAB_TRIGGER && handSpawn != null && wait <= 0)
        {
            GameObject spawn = Instantiate(handSpawn, skeletal_hand.GetPalmCenter(), Quaternion.identity)
                               as GameObject;
            spawn.rigidbody.velocity = VELOCITY_SPAWN * (skeletal_hand.GetPalmRotation() * Vector3.down);
            wait = SPAWN_WAIT_ITERATIONS;
            Physics.IgnoreCollision(skeletal_hand.palm.collider, spawn.collider);
        }

        wait--;
    }
        private IDictionary <string, SkeletalHand> FindHands()
        {
            IDictionary <string, SkeletalHand> hands = new Dictionary <string, SkeletalHand>();
            string name = "leftHand";

            foreach (Transform gameObject in handsPrefab.transform)
            {
                if (gameObject.name == "MinimalHand(Clone)")
                {
                    SkeletalHand sh   = gameObject.GetComponent <SkeletalHand>();
                    Hand         hand = sh.GetLeapHand();

                    if (hand.IsRight)
                    {
                        name = "rightHand";
                    }

                    hands[name] = sh;
                }
            }

            return(hands);
        }