Esempio n. 1
0
    /// <summary>
    /// Displays the visual information of the performed trigger gesture.
    /// </summary>
    /// <param name="triggerGesture">Trigger gesture.</param>
    void TriggerDisplay(TrackingInfo trackingInfo, ManoGestureTrigger triggerGesture)
    {
        if (GetCurrentPooledTrigger())
        {
            GameObject triggerVisualInformation = GetCurrentPooledTrigger();

            triggerVisualInformation.SetActive(true);
            triggerVisualInformation.name = triggerGesture.ToString();
            triggerVisualInformation.GetComponent <TriggerGizmo>().InitializeTriggerGizmo(triggerGesture);
            triggerVisualInformation.GetComponent <RectTransform>().position = Camera.main.ViewportToScreenPoint(trackingInfo.palm_center);
        }
    }
Esempio n. 2
0
    /// <summary>
    /// Displays the visual information of the performed trigger gesture.
    /// </summary>
    /// <param name="bounding_box">Bounding box.</param>
    /// <param name="triggerGesture">Trigger gesture.</param>
    void TriggerDisplay(TrackingInfo trackingInfo, ManoGestureTrigger triggerGesture)
    {
        if (GetCurrentPooledTrigger())
        {
            GameObject triggerVisualInformation = GetCurrentPooledTrigger();

            triggerVisualInformation.SetActive(true);

            triggerVisualInformation.name = triggerGesture.ToString();
            triggerVisualInformation.GetComponent <TriggerGizmo>().InitializeTriggerGizmo(triggerGesture);

            triggerVisualInformation.GetComponent <RectTransform>().position = ManoUtils.Instance.CalculateScreenPosition(trackingInfo.palm_center, trackingInfo.depth_estimation);
        }
    }
Esempio n. 3
0
    /// <summary>
    /// Displays the visual information of the performed trigger gesture.
    /// </summary>
    /// <param name="bounding_box">Bounding box.</param>
    /// <param name="triggerGesture">Trigger gesture.</param>
    void TriggerDisplay(BoundingBox bounding_box, ManoGestureTrigger triggerGesture)
    {
        GameObject triggerVisualInformation = Instantiate(triggerTextPrefab);

        triggerVisualInformation.name = triggerGesture.ToString();
        triggerVisualInformation.GetComponent <TriggerGizmo>().SetTriggerGizmoVisualization(triggerGesture);
        triggerVisualInformation.transform.SetParent(transform);
        triggerVisualInformation.transform.localPosition = new Vector2((bounding_box.top_left.x + bounding_box.width / 2) * Screen.width, (1 - bounding_box.top_left.y - bounding_box.height / 2) * Screen.height);

        float midX = (bounding_box.top_left.x + bounding_box.width / 2);
        float midY = (1 - bounding_box.top_left.y - bounding_box.height / 2);

        triggerVisualInformation.GetComponent <RectTransform>().position = Camera.main.ViewportToScreenPoint(new Vector2(midX, midY));
    }