override protected void NewStateUpdate()
 {
     if (distanceToBody > distance_threshold_up * 9 / 8)
     {
         new_state = Right_hand_states.RIGHT_HAND_HIGH;
     }
     else if (distanceToBody < distance_threshold_down)
     {
         new_state = Right_hand_states.RIGHT_HAND_LOW;
     }
     else if (distanceToBody < distance_threshold_up * 9 / 8 && distanceToBody > distance_threshold_down)
     {
         new_state = Right_hand_states.RIGHT_HAND_MIDDLE;
     }
     else
     {
     }
     b1 = false;
 }
 // Update is called once per frame
 void Update()
 {
     UpdateThreshold();
     new_state = Right_hand_states.RIGHT_HAND_NEUTRAL;
     if (kmc.isTracked)
     {
         right_hand_position     = kmc.Hand_Right.transform.position;
         right_shoulder_position = kmc.Shoulder_Right.transform.position;
         distanceToBody          = right_hand_position.x - right_shoulder_position.x;
         //à affiner selon le transform que l'on mettra
         //right_hand_position = kmc.transform.position;
         NewStateUpdate();
         StateTransition();
     }
     else
     {
         b1 = false;
     }
 }
示例#3
0
    // Update is called once per frame
    void Update()
    {
        UpdateThreshold();
        new_state = Right_hand_states.RIGHT_HAND_NEUTRAL;
        if (kmc.isTracked)
        {
            right_hand_position_2  = right_hand_position_1;
            right_hand_position_1  = kmc.Hand_Right.transform.position;
            left_shoulder_position = kmc.Shoulder_Right.transform.position;
            distanceToBody         = Mathf.Abs(right_hand_position_1.z - left_shoulder_position.z);

            //Debug.Log(punchSpeed);
            //Debug.Log(distanceToBody);
            distanceHandShoulderY = Mathf.Abs(right_hand_position_1.y - left_shoulder_position.y);
            //à affiner selon le transform que l'on mettra
            //right_hand_position = kmc.transform.position;
        }
        else
        {
            b1 = false;
        }
    }
示例#4
0
    override protected void NewStateUpdate()
    {
        if (distanceHandShoulderY < marge)
        {
            new_state = Right_hand_states.BOXING_STATE;
        }
        //if (distanceHandShoulderY > marge)
        //    Debug.Log("Mauvaise position de punch !");
        else if (punchSpeed > punchSpeedMarge && distanceHandShoulderY < marge)
        {
            new_state = Right_hand_states.RIGHT_HAND_PUNCH_STATE;
        }
        //if (distanceToBody > distance_threshold_up && distanceHandShoulderY < distance_threshold_down / 2)
        //    new_state = Right_hand_states.RIGHT_HAND_HIGH;
        //else if (distanceToBody < distance_threshold_down * 0.75 && distanceHandShoulderY < distance_threshold_down / 2)
        //    new_state = Right_hand_states.RIGHT_HAND_LOW;
        //else if (distanceToBody < distance_threshold_up && distanceToBody > distance_threshold_down * 0.75 && distanceHandShoulderY < distance_threshold_down / 2)
        //    new_state = Right_hand_states.RIGHT_HAND_MIDDLE;
        else
        {
        }

        b1 = false;
    }