Example #1
0
 /// <summary>
 /// Displays the fingertip points as detected from the hand
 /// </summary>
 /// <param name="tracking_info">Requires tracking information of the hand</param>
 /// <param name="index">Requires the int index value that refers to a given hand from the array of hands </param>
 private void ShowFingerTips(TrackingInfo tracking_info, int index)
 {
     fingertip_parent.SetActive(_show_fingertips);
     if (_show_fingertips)
     {
         for (int i = 0; i < 5; i++)
         {
             if (tracking_info.finger_tips.Length > i && tracking_info.finger_tips[i].x >= 0)
             {
                 fingertips_t[index][i].gameObject.SetActive(true);
                 Vector3 newPos = mano_utils.CalculateNewPosition(tracking_info.finger_tips[i], tracking_info.relative_depth);
                 fingertips_t[index][i].position = Vector3.Lerp(fingertips_t[index][i].position, newPos, .8f);
             }
             else
             {
                 fingertips_t[index][i].gameObject.SetActive(false);
             }
         }
     }
 }
 /// <summary>
 /// Displays the fingertip points as detected from the hand
 /// </summary>
 /// <param name="tracking_info">Requires tracking information of the hand</param>
 /// <param name="index">Requires the int index value that refers to a given hand from the array of hands </param>
 private void ShowFingerTips(TrackingInfo tracking_info, int index)
 {
     fingertip_parent.SetActive(_show_fingertips && ManomotionManager.Instance.Hand_infos[0].hand_info.warning != Warning.WARNING_HAND_NOT_FOUND);
     if (_show_fingertips)
     {
         for (int i = 0; i < 5; i++)
         {
             if (tracking_info.finger_tips.Length > i && tracking_info.finger_tips[i].x >= 0)
             {
                 fingertips_t[index][i].gameObject.SetActive(true);
                 Vector3 newPos = mano_utils.CalculateNewPosition(tracking_info.finger_tips[i], tracking_info.relative_depth - 0.1f);
                 fingertips_t[index][i].localPosition = Vector3.Lerp(fingertips_t[index][i].position, newPos, .8f);
                 fingertips_t[index][i].localRotation = Quaternion.identity;
             }
             else
             {
                 fingertips_t[index][i].gameObject.SetActive(false);
             }
         }
     }
 }
Example #3
0
    // Update is called once per frame
    public void UpdateInfo(BoundingBox bounding_box)
    {
        bound_line_renderer.SetPosition(0, mano_utils.CalculateNewPosition(new Vector3(bounding_box.top_left.x, 1 - bounding_box.top_left.y, 1), 1));
        bound_line_renderer.SetPosition(1, mano_utils.CalculateNewPosition(new Vector3(bounding_box.top_left.x + bounding_box.width, 1 - bounding_box.top_left.y, 1), 1));
        bound_line_renderer.SetPosition(2, mano_utils.CalculateNewPosition(new Vector3(bounding_box.top_left.x + bounding_box.width, (1 - bounding_box.top_left.y - bounding_box.height), 1), 1));
        bound_line_renderer.SetPosition(3, mano_utils.CalculateNewPosition(new Vector3(bounding_box.top_left.x, (1 - bounding_box.top_left.y - bounding_box.height), 1), 1));

        top_left.gameObject.transform.position = mano_utils.CalculateNewPosition(new Vector3(bounding_box.top_left.x, 1.05f - bounding_box.top_left.y, 1), 1);
        top_left.text = "Top Left: " + "X: " + bounding_box.top_left.x.ToString("F2") + " Y: " + bounding_box.top_left.y.ToString("F2");

        height.transform.position             = mano_utils.CalculateNewPosition(new Vector3(bounding_box.top_left.x + bounding_box.width + 0.025f, (1 - bounding_box.top_left.y - bounding_box.height / 2f), 1), 1);
        height.GetComponent <TextMesh>().text = "Height: " + bounding_box.height.ToString("F2");

        width.transform.position             = mano_utils.CalculateNewPosition(new Vector3(bounding_box.top_left.x + bounding_box.width / 2f, (1 - bounding_box.top_left.y - bounding_box.height) - 0.025f, 1), 1);
        width.GetComponent <TextMesh>().text = "Width: " + bounding_box.width.ToString("F2");
    }
Example #4
0
    // Update is called once per frame
    public void UpdateInfo(BoundingBox bounding_box)
    {
        topLeftX = Mathf.Lerp(topLeftX, bounding_box.top_left.x, smoothingFactor);
        topLeftY = Mathf.Lerp(topLeftY, bounding_box.top_left.y, smoothingFactor);
        bbWidth  = Mathf.Lerp(bbWidth, bounding_box.width, smoothingFactor);
        bbHeight = Mathf.Lerp(bbHeight, bounding_box.height, smoothingFactor);

        if (!mano_utils)
        {
            mano_utils = ManoUtils.Instance;
        }
        if (!bound_line_renderer)
        {
            Debug.Log("bound_line_renderer: null");
        }

        bound_line_renderer.SetPosition(0, mano_utils.CalculateNewPosition(new Vector3(topLeftX, 1 - topLeftY, 1), 1));
        bound_line_renderer.SetPosition(1, mano_utils.CalculateNewPosition(new Vector3(topLeftX + bbWidth, 1 - topLeftY, 1), 1));
        bound_line_renderer.SetPosition(2, mano_utils.CalculateNewPosition(new Vector3(topLeftX + bbWidth, (1 - topLeftY - bbHeight), 1), 1));
        bound_line_renderer.SetPosition(3, mano_utils.CalculateNewPosition(new Vector3(topLeftX, (1 - topLeftY - bbHeight), 1), 1));

        top_left.gameObject.transform.position = mano_utils.CalculateNewPosition(new Vector3(topLeftX, 1.05f - topLeftY, 1), 1);
        top_left.text = "Top Left: " + "X: " + topLeftX.ToString("F2") + " Y: " + topLeftY.ToString("F2");

        height.transform.position             = mano_utils.CalculateNewPosition(new Vector3(topLeftX + bbWidth + 0.025f, (1 - topLeftY - bbHeight / 2f), 1), 1);
        height.GetComponent <TextMesh>().text = "Height: " + bbHeight.ToString("F2");

        width.transform.position             = mano_utils.CalculateNewPosition(new Vector3(topLeftX + bbWidth / 2f, (1 - topLeftY - bbHeight) - 0.025f, 1), 1);
        width.GetComponent <TextMesh>().text = "Width: " + bbWidth.ToString("F2");

        //pure data
        //bound_line_renderer.SetPosition(0, mano_utils.CalculateNewPosition(new Vector3(bounding_box.top_left.x, 1 - bounding_box.top_left.y, 1), 1));
        //bound_line_renderer.SetPosition(1, mano_utils.CalculateNewPosition(new Vector3(bounding_box.top_left.x + bounding_box.width, 1 - bounding_box.top_left.y, 1), 1));
        //bound_line_renderer.SetPosition(2, mano_utils.CalculateNewPosition(new Vector3(bounding_box.top_left.x + bounding_box.width, (1 - bounding_box.top_left.y - bounding_box.height), 1), 1));
        //bound_line_renderer.SetPosition(3, mano_utils.CalculateNewPosition(new Vector3(bounding_box.top_left.x, (1 - bounding_box.top_left.y - bounding_box.height), 1), 1));

        //top_left.gameObject.transform.position = mano_utils.CalculateNewPosition(new Vector3(bounding_box.top_left.x, 1.05f - bounding_box.top_left.y, 1), 1);
        //top_left.text = "Top Left: " + "X: " + bounding_box.top_left.x.ToString("F2") + " Y: " + bounding_box.top_left.y.ToString("F2");

        //height.transform.position = mano_utils.CalculateNewPosition(new Vector3(bounding_box.top_left.x + bounding_box.width + 0.025f, (1 - bounding_box.top_left.y - bounding_box.height / 2f), 1), 1);
        //height.GetComponent<TextMesh>().text = "Height: " + bounding_box.height.ToString("F2");

        //width.transform.position = mano_utils.CalculateNewPosition(new Vector3(bounding_box.top_left.x + bounding_box.width / 2f, (1 - bounding_box.top_left.y - bounding_box.height) - 0.025f, 1), 1);
        //width.GetComponent<TextMesh>().text = "Width: " + bounding_box.width.ToString("F2");
    }